PHP Class Symfony\Component\Security\Http\Firewall\AbstractAuthenticationListener

Subclasses likely have to implement the following: - an TokenInterface to hold authentication related data - an AuthenticationProvider to perform the actual authentication of the token, retrieve the UserInterface implementation from a database, and perform the specific account checks using the UserChecker By default, this listener only is active for a specific path, e.g. login_check. If you want to change this behavior, you can overwrite the requiresAuthentication() method.
Author: Fabien Potencier ([email protected])
Author: Johannes M. Schmitt ([email protected])
Inheritance: implements Symfony\Component\Security\Http\Firewall\ListenerInterface
Show file Open project: pmjones/php-framework-benchmarks Class Usage Examples

Protected Properties

Property Type Description
$authenticationManager
$logger
$options
$providerKey

Public Methods

Method Description
__construct ( Symfony\Component\Security\Core\SecurityContextInterface $securityContext, Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface $authenticationManager, Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, string $providerKey, array $options = [], Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface $successHandler = null, Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface $failureHandler = null, Symfony\Component\HttpKernel\Log\LoggerInterface $logger = null, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher = null ) Constructor.
handle ( GetResponseEvent $event ) Handles form based authentication.
setRememberMeServices ( Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface $rememberMeServices ) Sets the RememberMeServices implementation to use

Protected Methods

Method Description
attemptAuthentication ( Request $request ) : Symfony\Component\Security\Core\Authentication\Token\TokenInterface Performs authentication.
requiresAuthentication ( Request $request ) : boolean Whether this request requires authentication.

Private Methods

Method Description
determineTargetUrl ( Request $request ) : string Builds the target URL according to the defined options.
onFailure ( GetResponseEvent $event, Request $request, Symfony\Component\Security\Core\Exception\AuthenticationException $failed )
onSuccess ( GetResponseEvent $event, Request $request, Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token )

Method Details

__construct() public method

Constructor.
public __construct ( Symfony\Component\Security\Core\SecurityContextInterface $securityContext, Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface $authenticationManager, Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, string $providerKey, array $options = [], Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface $successHandler = null, Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface $failureHandler = null, Symfony\Component\HttpKernel\Log\LoggerInterface $logger = null, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher = null )
$securityContext Symfony\Component\Security\Core\SecurityContextInterface A SecurityContext instance
$authenticationManager Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface An AuthenticationManagerInterface instance
$sessionStrategy Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface
$httpUtils Symfony\Component\Security\Http\HttpUtils An HttpUtilsInterface instance
$providerKey string
$options array An array of options for the processing of a successful, or failed authentication attempt
$successHandler Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface
$failureHandler Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface
$logger Symfony\Component\HttpKernel\Log\LoggerInterface A LoggerInterface instance
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface An EventDispatcherInterface instance

attemptAuthentication() abstract protected method

Performs authentication.
abstract protected attemptAuthentication ( Request $request ) : Symfony\Component\Security\Core\Authentication\Token\TokenInterface
$request Symfony\Component\HttpFoundation\Request A Request instance
return Symfony\Component\Security\Core\Authentication\Token\TokenInterface The authenticated token, or null if full authentication is not possible

handle() final public method

Handles form based authentication.
final public handle ( GetResponseEvent $event )
$event Symfony\Component\HttpKernel\Event\GetResponseEvent A GetResponseEvent instance

requiresAuthentication() protected method

The default implementation only processed requests to a specific path, but a subclass could change this to only authenticate requests where a certain parameters is present.
protected requiresAuthentication ( Request $request ) : boolean
$request Symfony\Component\HttpFoundation\Request
return boolean

setRememberMeServices() public method

Sets the RememberMeServices implementation to use
public setRememberMeServices ( Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface $rememberMeServices )
$rememberMeServices Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface

Property Details

$authenticationManager protected property

protected $authenticationManager

$logger protected property

protected $logger

$options protected property

protected $options

$providerKey protected property

protected $providerKey