Class SignOutTokenProviderExtensions
Signs the user out of the token providers that hold a user session.
public static class SignOutTokenProviderExtensions
- Inheritance
-
SignOutTokenProviderExtensions
- Inherited Members
Methods
AddTokenProvidersSignOut(IServiceCollection)
Registers SignOutTokenProviderKeys, so SignOutTokenProvidersAsync<T>(IServiceProvider, IKeyValueSettings, ILogger<T>, CancellationToken) resolves each token provider separately: a provider that cannot be resolved (missing or scoped dependency) does not prevent the sign-out of the others. It can be called before or after the token providers are registered.
public static IServiceCollection AddTokenProvidersSignOut(this IServiceCollection services)
Parameters
servicesIServiceCollectionThe service collection.
Returns
- IServiceCollection
The service collection.
SignOutTokenProvidersAsync<T>(IServiceProvider, IKeyValueSettings, ILogger<T>, CancellationToken)
Calls SignOutAsync(IKeyValueSettings, CancellationToken) on every keyed ITokenProvider of the container that implements ISignOutTokenProvider, once per instance. The same settings are given to every provider: a provider ignores the settings that do not designate it. When SignOutTokenProviderKeys is registered (AddTokenProvidersSignOut(IServiceCollection)), each provider is resolved separately; otherwise all the keyed providers are resolved together, and one that cannot be resolved prevents the sign-out of all of them. An exception thrown when the providers are resolved or signed out is logged and not rethrown, so one provider cannot prevent the sign-out of the others.
public static ValueTask SignOutTokenProvidersAsync<T>(this IServiceProvider container, IKeyValueSettings settings, ILogger<T> logger, CancellationToken cancellationToken)
Parameters
containerIServiceProviderThe service provider in which the token providers are registered.
settingsIKeyValueSettingsThe settings given to each provider.
loggerILogger<T>The logger in which the exceptions are written.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- ValueTask
A task that completes when every provider is signed out.
Type Parameters
TThe category of the logger.
Exceptions
- OperationCanceledException
cancellationTokenis cancelled.