class AuthenticationCollector implements AuthenticationCollectorInterface (View source)

A collector class for authentication providers.

Properties

protected AuthenticationProviderInterface[] $providers

Array of all registered authentication providers, keyed by ID.

protected array $providerOrders

Array of all providers and their priority.

protected AuthenticationProviderInterface[] $sortedProviders

Sorted list of registered providers.

protected string[] $globalProviders

List of providers which are allowed on routes with no _auth option.

Methods

addProvider(AuthenticationProviderInterface $provider, string $provider_id, int $priority = 0, bool $global = FALSE)

Adds a provider to the array of registered providers.

bool
isGlobal(string $provider_id)

Returns whether a provider is considered global.

getProvider(string $provider_id)

Returns an authentication provider.

getSortedProviders()

Returns the sorted array of authentication providers.

Details

addProvider(AuthenticationProviderInterface $provider, string $provider_id, int $priority = 0, bool $global = FALSE)

Adds a provider to the array of registered providers.

Parameters

AuthenticationProviderInterface $provider

The provider object.

string $provider_id

Identifier of the provider.

int $priority

(optional) The provider's priority.

bool $global

(optional) TRUE if the provider is to be applied globally on all routes. Defaults to FALSE.

bool isGlobal(string $provider_id)

Returns whether a provider is considered global.

Parameters

string $provider_id

The provider ID.

Return Value

bool

TRUE if the provider is global, FALSE otherwise.

AuthenticationProviderInterface|null getProvider(string $provider_id)

Returns an authentication provider.

Parameters

string $provider_id

The provider ID.

Return Value

AuthenticationProviderInterface|null

The authentication provider which matches the ID.

AuthenticationProviderInterface[] getSortedProviders()

Returns the sorted array of authentication providers.

Return Value

AuthenticationProviderInterface[]

An array of authentication provider objects.