Namespace Arc4u.OAuth2.Token
Classes
- ApplicationCache
An ITokenCache that stores the tokens in the cache designated by CacheName (the default cache when the name is empty or unknown). The keys are lower-cased and suffixed with
_TokenCache.
- ApplicationLocalDataCache
An ITokenCache for a local client application: the token is persisted in the ISecureCache and kept in memory for the next reads.
- CacheHelper
Default ICacheHelper: resolves the cache named by CacheName, and falls back to the default cache.
- JwtHttpHandler<T>
A DelegatingHandler that adds the token of the current user to the requests of an HttpClient. The token provider is selected by the
ProviderIdof the settings. Nothing is added when the request already has anAuthorizationheader, when the authentication type of the settings differs from the one of the current identity (unless it isInject), when no provider or no valid token is found. The culture of the user is added in acultureheader.
- NullTokenProvider
An ITokenProvider that does not provide any token. It is used when a client must not send a token.
- SignOutGeneration
Counts the sign-outs of a token provider, so a token requested before a sign-out is not kept after it: take a Snapshot() before requesting the token, and keep the token only when HasChanged(int) is false. The sign-out calls Increment().
- SignOutTokenProviderExtensions
Signs the user out of the token providers that hold a user session.
- SignOutTokenProviderKeys
The keys of the keyed ITokenProvider registrations that can hold a user session, read from the service collection the first time they are needed (the collection is complete once the container is built, so the order of the registrations does not matter). It is registered by AddTokenProvidersSignOut(IServiceCollection).
- TechnicalLoggerExtensions
Logs the exceptions of the token providers and of the sign-out, whatever the logger registered by the application.
- TokenCacheKey
Builds the hashed part of a token cache key.
The token cache can be distributed (Redis, SQL Server) or persistent, so a key must be the same in every process and after a restart: GetHashCode() is randomized per process and must not be used. Secrets (passwords, client secrets, user tokens) must not appear in clear text in a key either, since keys are logged.
- TokenInfo
A token with its type and expiration date.
- TokenKeys
The keys of the key/value settings that configure the token providers.
- TokenRefreshInfo
Holds the access token and the refresh token obtained from an identity provider.
- UserProfileExt
Extension methods reading the access token expiration from the
expclaim of an identity.
- UsernamePasswordTokenProvider
An ITokenProvider for a client application whose user signs in with a user name and password. The credentials are kept in the secure cache; when they are missing, they are requested from the registered IUserNamePasswordProvider. A token is requested from the
CredentialDirectICredentialTokenProvider and cached until it expires in less than one minute. TheAuthorityandServiceApplicationIdsettings are required; PasswordStoreKey selects the cache entries of the credentials (secretby default).
Interfaces
- ICacheHelper
Gives access to the cache used to store the tokens.
- ICredentialTokenProvider
Requests an access token for a user from his credentials.
- ISignOutTokenProvider
An ITokenProvider that holds tokens for a user session and removes them when the user signs out. Providers without a user session (machine to machine, a secret given by the settings, the token of the incoming request...) only implement ITokenProvider.
- ITokenCache
A store for the tokens of the current user.
- ITokenProvider
Provides an access token for a set of settings. A provider that holds tokens for a user session (and must remove them when the user signs out) also implements ISignOutTokenProvider.
- ITokenRefreshProvider
Refreshes the access token of the current user with his refresh token.
- IUserNamePasswordProvider
Provides the user name and password of the user, for example by prompting him.
Delegates
- CheckCredentialsAsync
Validates a user name and a password.