Class OAuthHandler
HTTP message delegating handler that transparently performs OAuth 2.0 authentication with a client secret. Performs OpenID Connect discovery to find the token endpoint.
public class OAuthHandler : DelegatingHandler, IDisposable
- Inheritance
-
objectOAuthHandler
- Implements
- Inherited Members
Constructors
OAuthHandler(OAuthOptions, HttpMessageHandler?)
Creates a new OAuth handler.
public OAuthHandler(OAuthOptions oAuthOptions, HttpMessageHandler? innerHandler = null)
Parameters
oAuthOptionsOAuthOptionsOptions for OAuth 2.0 / OpenID Connect authentication.
innerHandlerHttpMessageHandlerAn optional inner HTTP message handler to delegate to.
Methods
Dispose(bool)
Releases the unmanaged resources used by the DelegatingHandler, and optionally disposes of the managed resources.
protected override void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to releases only unmanaged resources.
SendAsync(HttpRequestMessage, CancellationToken)
Sends an HTTP request to the inner handler to send to the server as an asynchronous operation.
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
requestHttpRequestMessageThe HTTP request message to send to the server.
cancellationTokenCancellationTokenA cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
The
requestwas null.- OperationCanceledException
The cancellation token was canceled. This exception is stored into the returned task.