Class ClientCredentialsTokenProvider
- Namespace
- SEBT.Portal.StatePlugins.CO.CbmsApi
- Assembly
- SEBT.Portal.StatePlugins.CO.CbmsApi.dll
Microsoft.Kiota.Abstractions.Authentication.IAccessTokenProvider that obtains OAuth 2.0 bearer tokens via the client_credentials grant. Tokens are cached and refreshed 60 seconds before expiry using a System.Threading.SemaphoreSlim for thread safety.
public class ClientCredentialsTokenProvider
- Inheritance
-
objectClientCredentialsTokenProvider
Constructors
ClientCredentialsTokenProvider(HttpClient, string, string, string, ILogger?)
public ClientCredentialsTokenProvider(HttpClient httpClient, string clientId, string clientSecret, string tokenEndpointUrl, ILogger? logger = null)
Parameters
httpClientHttpClientclientIdstringclientSecretstringtokenEndpointUrlstringloggerILogger
Properties
AllowedHostsValidator
Returns the Microsoft.Kiota.Abstractions.Authentication.IAccessTokenProvider.AllowedHostsValidator for the provider.
public AllowedHostsValidator AllowedHostsValidator { get; }
Property Value
- AllowedHostsValidator
Methods
GetAuthorizationTokenAsync(Uri, Dictionary<string, object>?, CancellationToken)
This method is called by the Microsoft.Kiota.Abstractions.Authentication.BaseBearerTokenAuthenticationProvider class to get the access token.
public Task<string> GetAuthorizationTokenAsync(Uri uri, Dictionary<string, object>? additionalAuthenticationContext = null, CancellationToken cancellationToken = default)
Parameters
uriUriThe target URI to get an access token for.
additionalAuthenticationContextDictionary<string, object>Additional authentication context to pass to the authentication library.
cancellationTokenCancellationTokenThe cancellation token for the task
Returns
- Task<string>
A Task that holds the access token to use for the request.