Created
October 7, 2014 20:21
-
-
Save afurculita/cea5e7e52b90c02590e7 to your computer and use it in GitHub Desktop.
Check if user is authenticated in Symfony2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AcmeClass { | |
public function isAuthenticated() | |
{ | |
return !$this->container->get('security.context')->isGranted('IS_AUTHENTICATED_ANONYMOUSLY'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment