class BasicAuth implements AuthenticationProviderInterface, AuthenticationProviderChallengeInterface (View source)

HTTP Basic authentication provider.

Properties

protected ConfigFactoryInterface $configFactory

The config factory.

protected UserAuthInterface $userAuth

The user auth service.

protected FloodInterface $flood

The flood service.

protected EntityTypeManagerInterface $entityTypeManager

The entity type manager service.

Methods

__construct(ConfigFactoryInterface $config_factory, UserAuthInterface $user_auth, FloodInterface $flood, EntityTypeManagerInterface $entity_type_manager)

Constructs a HTTP basic authentication provider object.

bool
applies(Request $request)

Checks whether suitable authentication credentials are on the request.

authenticate(Request $request)

Authenticates the user.

HttpExceptionInterface|null
challengeException(Request $request, Exception $previous)

Constructs an exception which is used to generate the challenge.

Details

__construct(ConfigFactoryInterface $config_factory, UserAuthInterface $user_auth, FloodInterface $flood, EntityTypeManagerInterface $entity_type_manager)

Constructs a HTTP basic authentication provider object.

Parameters

ConfigFactoryInterface $config_factory

The config factory.

UserAuthInterface $user_auth

The user authentication service.

FloodInterface $flood

The flood service.

EntityTypeManagerInterface $entity_type_manager

The entity type manager service.

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.

HttpExceptionInterface|null challengeException(Request $request, Exception $previous)

Constructs an exception which is used to generate the challenge.

Parameters

Request $request

The request.

Exception $previous

The previous exception.

Return Value

HttpExceptionInterface|null

An exception to be used in order to generate an authentication challenge.