Improve this Doc View Source

Class OAuth1HttpMessageHandler

This DelegatingHandler handles the OAuth specific stuff and delegates the "final" SendAsync to the InnerHandler

Inheritance
System.Object
System.Net.Http.HttpMessageHandler
System.Net.Http.DelegatingHandler
OAuth1HttpMessageHandler
Namespace:Dapplo.HttpExtensions.OAuth
Assembly:Dapplo.HttpExtensions.dll
Syntax
public class OAuth1HttpMessageHandler : DelegatingHandler, IDisposable

Constructors

| Improve this Doc View Source

OAuth1HttpMessageHandler(OAuth1Settings, OAuth1HttpBehaviour, HttpMessageHandler)

Create a HttpMessageHandler which handles the OAuth communication for you

Declaration
public OAuth1HttpMessageHandler(OAuth1Settings oAuth1Settings, OAuth1HttpBehaviour oAuth1HttpBehaviour, HttpMessageHandler innerHandler)
Parameters
Type Name Description
OAuth1Settings oAuth1Settings

OAuth1Settings

OAuth1HttpBehaviour oAuth1HttpBehaviour

OAuth1HttpBehaviour

System.Net.Http.HttpMessageHandler innerHandler

HttpMessageHandler

Properties

| Improve this Doc View Source

CodeReceivers

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 OAuthSettings 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 Source

ComputeHash(HashAlgorithm, String)

Helper function to compute a hash value

Declaration
public static string ComputeHash(HashAlgorithm hashAlgorithm, string data)
Parameters
Type Name Description
System.Security.Cryptography.HashAlgorithm hashAlgorithm

The hashing algorithm used. If that algorithm needs some initialization, like HMAC and its derivatives, they should be initialized prior to passing it to this function

System.String data

The data to hash

Returns
Type Description
System.String

a Base64 string of the hash value

| Improve this Doc View Source

GenerateNonce()

Generate a nonce

Declaration
public static string GenerateNonce()
Returns
Type Description
System.String
| Improve this Doc View Source

GenerateTimeStamp()

Generate the timestamp for the signature

Declaration
public static string GenerateTimeStamp()
Returns
Type Description
System.String
| Improve this Doc View Source

SendAsync(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