13
votes
3answers
9k views

Doctrine based authentication mechanism in Symfony2 project

I am working on a small Doctrine2-backed project using Symfony2 for the first time. Currently I'm struggling with the security component of symfony2, to be exact with the authentication mechanism ...
13
votes
1answer
4k views

In Symfony 2, how do I check if a user is not logged in (inside a template)?

In Symfony 2 templates (Twig), how can I effectively check whether a user is not logged in? I don't want to use ROLE checks. I wan't a straightforward way to check if a user is not logged in. I'm ...
11
votes
3answers
6k views

Authentication for a Symfony2 api (for mobile app use)

I've developed a REST api for my Symfony2 application. This api will be used by a mobile app. Much of the functionality is done in the context of the currently authenticated user, ie: ...
10
votes
1answer
2k views

How to programmatically login/authenticate a user?

I'd like to log the user in right after the registration process, without passing by the login form. Is this possible ? I've found a solution with FOSUserBundle, but I'm not using it on the project ...
8
votes
2answers
646 views

Migrating legacy users to symfony2

I'm moving from expressionengine to symfony2 and I'm looking for the best way to migrate the user passwords. The goal is to let legacy users log in with their existing credentials, while passwords for ...
7
votes
1answer
2k views

Symfony 2 receiving anonymous token after basic authentication

I have a Symfony 2 app using the basic in_memory authentication (as described in the security documentation). The login works fine in our development environment(s). But on the staging server, the ...
6
votes
2answers
2k views

Symfony2, switch to HTTPS after authentication

I want to force user to use HTTPS instead of HTTP but only after authentication. The only option I've found is forcing HTTPS on per controller/method basis. Anonymous users should only use HTTP. How ...
6
votes
1answer
9k views

Symfony 2 authentication with (doctrine) Entity

I think I've tried all code in all posts about authentication with (doctrine) Entity in Symfony 2. And I can`t make it work. When I use in_memory provider all works fine. I'm using the PR8. My ...
6
votes
1answer
271 views

Symfony2 entity user provider overrides custom auth provider

My Symfony2 custom authentication provider now appears to be working. User Provider I almost used the FOSUserBundle but I don't even have email addresses for my users and I don't need the added ...
5
votes
3answers
3k views

Exception : Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken::serialize() must return a string or NULL

I am not able to authenticate in symfony2 with the 'Employee' entity as it contains many mapping with other entities in my project. some of my mapping is as follows: /** * @var ...
4
votes
3answers
2k views

How to develop by faking login to test ACLs in Symfony 2

I am developing a part of a web app build on Symfony 2. Like in many apps, authentication & authorization is required. How can I continue developing, taking considerations ACL by passing or faking ...
4
votes
1answer
1k views

Using Symfony2's AccessDeniedHandlerInterface

I am trying to get my security stuff setup for symfony2 and I have it working so far, but now I need to do some more fancy things. I am currently using everything dealing with PreAuthentication (I use ...
4
votes
3answers
1k views

Check_path isn't behind symfony's firewall , how to correct this?

I am trying to authenticate against symfony2 firewall , here is my security config security: encoders: Symfony\Component\Security\Core\User\User: plaintext role_hierarchy: ...
3
votes
1answer
3k views

Symfony 2 Logout (UserInterface::eraseCredentials)

I suppose eraseCredentials is meant for logout? If so how do I clear session from a Doctrine Entity?
3
votes
1answer
422 views

app.user.username in twig returns unable to add global

as per the documentation: http://symfony.com/doc/current/book/security.html#retrieving-the-user-object I am trying to use twig to check to see if the user is authenticated when i put in my twig ...

1 2 3 4 5 9
15 30 50 per page