Skip to content

Instantly share code, notes, and snippets.

@afurculita
Created October 7, 2014 20:21
Show Gist options
  • Save afurculita/cea5e7e52b90c02590e7 to your computer and use it in GitHub Desktop.
Save afurculita/cea5e7e52b90c02590e7 to your computer and use it in GitHub Desktop.
Check if user is authenticated in Symfony2
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