class AuthenticationSubscriber implements EventSubscriberInterface (View source)

Authentication subscriber.

Trigger authentication during the request.

Properties

protected AuthenticationProviderInterface $authenticationProvider

Authentication provider.

protected AuthenticationProviderFilterInterface|null $filter

Authentication provider filter.

protected AuthenticationProviderChallengeInterface|null $challengeProvider

Authentication challenge provider.

protected AccountProxyInterface $accountProxy

Account proxy.

Methods

__construct(AuthenticationProviderInterface $authentication_provider, AccountProxyInterface $account_proxy)

Constructs an authentication subscriber.

onKernelRequestAuthenticate(GetResponseEvent $event)

Authenticates user on request.

onKernelRequestFilterProvider(GetResponseEvent $event)

Denies access if authentication provider is not allowed on this route.

onExceptionSendChallenge(GetResponseForExceptionEvent $event)

Respond with a challenge on access denied exceptions if appropriate.

onExceptionAccessDenied(GetResponseForExceptionEvent $event)

Detect disallowed authentication methods on access denied exceptions.

static 
getSubscribedEvents()

{@inheritdoc}

Details

__construct(AuthenticationProviderInterface $authentication_provider, AccountProxyInterface $account_proxy)

Constructs an authentication subscriber.

Parameters

AuthenticationProviderInterface $authentication_provider

An authentication provider.

AccountProxyInterface $account_proxy

Account proxy.

onKernelRequestAuthenticate(GetResponseEvent $event)

Authenticates user on request.

Parameters

GetResponseEvent $event

The request event.

See also

AuthenticationProviderInterface::authenticate

onKernelRequestFilterProvider(GetResponseEvent $event)

Denies access if authentication provider is not allowed on this route.

Parameters

GetResponseEvent $event

The request event.

onExceptionSendChallenge(GetResponseForExceptionEvent $event)

Respond with a challenge on access denied exceptions if appropriate.

On a 403 (access denied), if there are no credentials on the request, some authentication methods (e.g. basic auth) require that a challenge is sent to the client.

Parameters

GetResponseForExceptionEvent $event

The exception event.

onExceptionAccessDenied(GetResponseForExceptionEvent $event)

Detect disallowed authentication methods on access denied exceptions.

Parameters

GetResponseForExceptionEvent $event

static getSubscribedEvents()

{@inheritdoc}