class Cookie implements AuthenticationProviderInterface (View source)

Cookie based authentication provider.

Properties

protected SessionConfigurationInterface $sessionConfiguration

The session configuration.

protected Connection $connection

The database connection.

Methods

__construct(SessionConfigurationInterface $session_configuration, Connection $connection)

Constructs a new cookie authentication provider.

bool
applies(Request $request)

Checks whether suitable authentication credentials are on the request.

authenticate(Request $request)

Authenticates the user.

getUserFromSession(SessionInterface $session)

Returns the UserSession object for the given session.

Details

__construct(SessionConfigurationInterface $session_configuration, Connection $connection)

Constructs a new cookie authentication provider.

Parameters

SessionConfigurationInterface $session_configuration

The session configuration.

Connection $connection

The database connection.

bool applies(Request $request)

Checks whether suitable authentication credentials are on the request.

Parameters

Request $request

The request object.

Return Value

bool

TRUE if authentication credentials suitable for this provider are on the request, FALSE otherwise.

AccountInterface|null authenticate(Request $request)

Authenticates the user.

Parameters

Request $request

The request object.

Return Value

AccountInterface|null

AccountInterface - in case of a successful authentication. NULL - in case where authentication failed.

protected AccountInterface|null getUserFromSession(SessionInterface $session)

Returns the UserSession object for the given session.

Parameters

SessionInterface $session

The session.

Return Value

AccountInterface|null

The UserSession object for the current user, or NULL if this is an anonymous session.