Class OidcTokenProvider
- Namespace
- Arc4u.OAuth2.TokenProviders
- Assembly
- Arc4u.OAuth2.AspNetCore.Authentication.dll
An ITokenProvider that returns the access token of a user authenticated with OpenID Connect and the cookie scheme. The token comes from the scoped TokenRefreshInfo; when it expires in less than ForceRefreshTimeoutTimeSpan, it is refreshed with the refresh token first.
[Export("Oidc", typeof(ITokenProvider))]
public class OidcTokenProvider : ITokenProvider
- Inheritance
-
OidcTokenProvider
- Implements
- Inherited Members
Constructors
OidcTokenProvider(ILogger<OidcTokenProvider>, TokenRefreshInfo, IOptions<OidcAuthenticationOptions>, ITokenRefreshProvider)
Initializes a new instance of the OidcTokenProvider class.
public OidcTokenProvider(ILogger<OidcTokenProvider> logger, TokenRefreshInfo tokenRefreshInfo, IOptions<OidcAuthenticationOptions> oidcOptions, ITokenRefreshProvider refreshTokenProvider)
Parameters
loggerILogger<OidcTokenProvider>The logger.
tokenRefreshInfoTokenRefreshInfoThe scoped access and refresh tokens of the user.
oidcOptionsIOptions<OidcAuthenticationOptions>The OpenID Connect authentication options.
refreshTokenProviderITokenRefreshProviderThe provider that refreshes the tokens.
Fields
ProviderName
The key (Oidc) under which the provider is registered.
public const string ProviderName = "Oidc"
Field Value
Methods
GetTokenAsync(IKeyValueSettings?, object?)
Gets the access token of the user, refreshing it when it is about to expire.
public ValueTask<Result<TokenInfo>> GetTokenAsync(IKeyValueSettings? settings, object? platformParameters)
Parameters
settingsIKeyValueSettingsThe provider settings, which must not be null.
platformParametersobjectNot used.
Returns
- ValueTask<Result<TokenInfo>>
The access token, or a failed result when the user is not logged in (no access and no refresh token).
Exceptions
- ArgumentNullException
settingsis null.