Class CredentialTokenProvider
- Namespace
- Arc4u.OAuth2.TokenProvider
- Assembly
- Arc4u.OAuth2.dll
An ICredentialTokenProvider that requests a token from the token endpoint of an authority with the OAuth2 resource owner password grant.
The provider is registered under the name ProviderName. The authority is read from the Authority key of the settings (or the Default authority), the
ClientId, optional ClientSecret and Scope (default openid) keys come from the settings too. Failing requests are retried during RetryInterval (90 seconds by default).
[Export("CredentialDirect", typeof(ICredentialTokenProvider))]
[Shared]
public class CredentialTokenProvider : ICredentialTokenProvider
- Inheritance
-
CredentialTokenProvider
- Implements
- Inherited Members
Constructors
CredentialTokenProvider(ILogger<CredentialTokenProvider>, IOptionsMonitor<AuthorityOptions>)
An ICredentialTokenProvider that requests a token from the token endpoint of an authority with the OAuth2 resource owner password grant.
The provider is registered under the name ProviderName. The authority is read from the Authority key of the settings (or the Default authority), the
ClientId, optional ClientSecret and Scope (default openid) keys come from the settings too. Failing requests are retried during RetryInterval (90 seconds by default).
public CredentialTokenProvider(ILogger<CredentialTokenProvider> logger, IOptionsMonitor<AuthorityOptions> authorityOptions)
Parameters
loggerILogger<CredentialTokenProvider>The logger.
authorityOptionsIOptionsMonitor<AuthorityOptions>The named authority options.
Fields
ProviderName
The name (CredentialDirect) under which the provider is registered.
public const string ProviderName = "CredentialDirect"
Field Value
Methods
GetTokenAsync(IKeyValueSettings, CredentialsResult)
Requests an access token for the credentials.
public ValueTask<Result<TokenInfo>> GetTokenAsync(IKeyValueSettings settings, CredentialsResult credential)
Parameters
settingsIKeyValueSettingsThe provider settings (authority, client id, scope...). See TokenKeys.
credentialCredentialsResultThe user credentials.