Class ValidatingIdentityProviderStore<T>
- Namespace
- Fdyay.IdentityServer.Hosting
- Assembly
- Fdyay.IdentityServer.AspNetCore.dll
Answers a stored identity provider its validator refuses as no provider at all.
public sealed class ValidatingIdentityProviderStore<T> : IIdentityProviderStore where T : IIdentityProviderStore
Type Parameters
T
- Inheritance
-
ValidatingIdentityProviderStore<T>
- Implements
- Inherited Members
Remarks
Duende 8.0.1's ValidatingIdentityProviderStore<T>, measured. Put in front of a host's store by
AddIdentityProviderStore<T>, AddIdentityProviderStoreCache<T> and
AddInMemoryIdentityProviders, as Duende puts it there; a store registered as
IIdentityProviderStore by hand is not validated, as it is not there.
An invalid row reads as no row, the answer every caller already handles: the scheme lookup says there is no such scheme, the sign-in page does not offer it and a challenge to it is refused. Before this, an OpenID Connect row with no authority was offered and failed with a 500 when a user picked it. The reason goes to the log and to InvalidIdentityProviderConfigurationEvent, on every read, because what an operator sees otherwise is a partner that has quietly disappeared.
The list of names is passed through unvalidated, as Duende passes it: validating it would mean reading every row in full to list them, and the scheme provider already resolves each listed name through GetBySchemeAsync(string, CancellationToken) before it offers it.
Constructors
ValidatingIdentityProviderStore(T, IIdentityProviderConfigurationValidator, IEventService, ILogger<ValidatingIdentityProviderStore<T>>)
Puts the validator in front of inner.
public ValidatingIdentityProviderStore(T inner, IIdentityProviderConfigurationValidator validator, IEventService events, ILogger<ValidatingIdentityProviderStore<T>> logger)
Parameters
innerTThe store whose rows are validated.
validatorIIdentityProviderConfigurationValidatorDecides whether a row is a configuration this server can serve.
eventsIEventServiceReceives an InvalidIdentityProviderConfigurationEvent for each refused row.
loggerILogger<ValidatingIdentityProviderStore<T>>Receives the reason a row was refused.
Methods
GetAllSchemeNamesAsync(CancellationToken)
Every provider's name, from the inner store unvalidated.
public Task<IEnumerable<IdentityProviderName>> GetAllSchemeNamesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels the read.
Returns
- Task<IEnumerable<IdentityProviderName>>
The providers' names.
GetBySchemeAsync(string, CancellationToken)
The provider from the inner store, or null when there is none or the validator refuses it.
public Task<IdentityProvider?> GetBySchemeAsync(string scheme, CancellationToken cancellationToken = default)
Parameters
schemestringThe provider's scheme name.
cancellationTokenCancellationTokenCancels the read.
Returns
- Task<IdentityProvider>
The provider, or null.