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
-
OAuthHandler
- Implements
- Inherited Members
Constructors
OAuthHandler(OAuthOptions, HttpMessageHandler?)
Creates a new OAuth handler.
public OAuthHandler(OAuthOptions oAuthOptions, HttpMessageHandler? innerHandler = null)
Parameters
oAuthOptions
OAuthOptionsOptions for OAuth 2.0 / OpenID Connect authentication.
innerHandler
HttpMessageHandlerAn optional inner HTTP message handler to delegate to.
Methods
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
request
HttpRequestMessageThe HTTP request message to send to the server.
cancellationToken
CancellationTokenA cancellation token to cancel operation.
Returns
- Task<HttpResponseMessage>
The task object representing the asynchronous operation.
Exceptions
- ArgumentNullException
The
request
was null.