Table of Contents

Class SignOutTokenProviderExtensions

Namespace
Arc4u.OAuth2.Token
Assembly
Arc4u.OAuth2.dll

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

services IServiceCollection

The 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

container IServiceProvider

The service provider in which the token providers are registered.

settings IKeyValueSettings

The settings given to each provider.

logger ILogger<T>

The logger in which the exceptions are written.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

ValueTask

A task that completes when every provider is signed out.

Type Parameters

T

The category of the logger.

Exceptions

OperationCanceledException

cancellationToken is cancelled.