Class OAuth2HttpMessageHandler
This DelegatingHandler handles the OAuth2 specific stuff and delegates the "final" SendAsync to the InnerHandler
Inheritance
System.Object
System.Net.Http.HttpMessageHandler
System.Net.Http.DelegatingHandler
OAuth2HttpMessageHandler
Namespace:Dapplo.HttpExtensions.OAuth
Assembly:Dapplo.HttpExtensions.dll
Syntax
public class OAuth2HttpMessageHandler : DelegatingHandler, IDisposable
Constructors
| Improve this Doc View SourceOAuth2HttpMessageHandler(OAuth2Settings, IHttpBehaviour, HttpMessageHandler)
Create a HttpMessageHandler which handles the OAuth 2 communication for you
Declaration
public OAuth2HttpMessageHandler(OAuth2Settings oAuth2Settings, IHttpBehaviour httpBehaviour, HttpMessageHandler innerHandler)
Parameters
Type | Name | Description |
---|---|---|
OAuth2Settings | oAuth2Settings | OAuth2Settings |
IHttpBehaviour | httpBehaviour | IHttpBehaviour |
System.Net.Http.HttpMessageHandler | innerHandler | HttpMessageHandler |
Properties
| Improve this Doc View SourceCodeReceivers
Register your special OAuth handler for the AuthorizeMode here Default the AuthorizeModes.LocalServer is registered. Your implementation is a function which returns a Task with a IDictionary string,string. It receives the OAuth2Settings and a CancellationToken. The return value should be that which the OAuth server gives as return values, no processing.
Declaration
public static IDictionary<AuthorizeModes, IOAuthCodeReceiver> CodeReceivers { get; }
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<AuthorizeModes, IOAuthCodeReceiver> |
Methods
| Improve this Doc View SourceSendAsync(HttpRequestMessage, CancellationToken)
Check the HttpRequestMessage if all OAuth setting are there, if not make this available.
Declaration
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage httpRequestMessage, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Net.Http.HttpRequestMessage | httpRequestMessage | HttpRequestMessage |
System.Threading.CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> | HttpResponseMessage |