class AuthenticationProviderManager implements AuthenticationManagerInterface (View source)

The default authentication manager, which relies on Authentication Providers to authenticate the tokens stored in the security context.

Properties

protected SessionManagerInterface $sessionManager
protected TokenAndProviderFactoryInterface $tokenAndProviderFactory
protected Context $securityContext

The security context of the current request

protected array|null $providerConfigurations

Injected configuration for providers.

protected bool $isAuthenticated
protected bool $isInitialized
protected string $authenticationStrategy

Methods

__construct(TokenAndProviderFactoryInterface $tokenAndProviderFactory)

No description

void
injectSettings(array $settings)

Inject the settings and does a fresh build of tokens based on the injected settings

getSecurityContext()

Returns the security context

void
authenticate()

Tries to authenticate the tokens in the security context (in the given order) with the available authentication providers, if needed.

bool
isAuthenticated()

Checks if one or all tokens are authenticated (depending on the authentication strategy).

void
logout()

Logout all active authentication tokens

void
emitAuthenticatedToken(TokenInterface $token)

Signals that the specified token has been successfully authenticated.

void
emitLoggedOut()

Signals that all active authentication tokens have been invalidated.

void
emitSuccessfullyAuthenticated()

Signals that authentication commenced and at least one token was authenticated.

Details

__construct(TokenAndProviderFactoryInterface $tokenAndProviderFactory)

No description

Parameters

TokenAndProviderFactoryInterface $tokenAndProviderFactory

void injectSettings(array $settings)

Inject the settings and does a fresh build of tokens based on the injected settings

Parameters

array $settings

The settings

Return Value

void

Exceptions

Exception

Context getSecurityContext()

Returns the security context

Return Value

Context

$securityContext The security context of the current request

void authenticate()

Tries to authenticate the tokens in the security context (in the given order) with the available authentication providers, if needed.

If the authentication strategy is set to "allTokens", all tokens have to be authenticated. If the strategy is set to "oneToken", only one token needs to be authenticated, but the authentication will stop after the first authenticated token. The strategy "atLeastOne" will try to authenticate at least one and as many tokens as possible.

bool isAuthenticated()

Checks if one or all tokens are authenticated (depending on the authentication strategy).

Will call authenticate() if not done before.

Return Value

bool

Exceptions

Exception

void logout()

Logout all active authentication tokens

Return Value

void

Exceptions

Exception
SessionNotStartedException

protected void emitAuthenticatedToken(TokenInterface $token)

Signals that the specified token has been successfully authenticated.

Parameters

TokenInterface $token

The token which has been authenticated

Return Value

void

protected void emitLoggedOut()

Signals that all active authentication tokens have been invalidated.

Note: the session will be destroyed after this signal has been emitted.

Return Value

void

protected void emitSuccessfullyAuthenticated()

Signals that authentication commenced and at least one token was authenticated.

Return Value

void