C# Класс SimpleOAuth.OAuthRequestWrapper

Contains a WebRequest and does all the necessary work in order to sign it as a valid OAuth request before it gets sent.
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
OAuthRequestWrapper System
createAuthorization void
createSignature void

Открытые методы

Метод Описание
InHeader ( ) : void

Complete the request signing and add the OAuth information to the Authorization header.

This must be your last step in the function chain.

WithCallback ( string callbackUrl ) : OAuthRequestWrapper

Set the callback address that the OAuth Request Token stage should use.

The oauth_callback is sometimes required at the Request Token stage in a three-legged OAuth login request. It is possible to set this for other request, but may be unexpected and cause issues.

WithEncryption ( EncryptionMethod enc ) : OAuthRequestWrapper

Set the encryption method that should be used for this request.

This is equivalent to setting OAuthRequestWrapper.SigningMethod. If it is not set, the default is to use EncryptionMethod.HMACSHA1.

WithPostParameters ( string parameters ) : OAuthRequestWrapper

Provide the POST request to generate a valid OAuth signature.

The OAuth standard requires POST parameters sent in application/x-www-form-urlencoded requests to be included in the OAuth base string to create a valid signature. If it is not provided, then the request will fail. If this is set, then the WebRequest.ContentType of the OAuthRequestWrapper.ContainedRequest will be set to 'application/x-www-form-urlencoded' if it is not already set.

WithTokens ( SimpleOAuth.Tokens oauthTokens ) : OAuthRequestWrapper

Set the tokens that should be used for this request.

This is equivalent to setting OAuthRequestWrapper.RequestTokens.

WithVerifier ( string verifier ) : OAuthRequestWrapper

Set the oauth_verifier in the OAuth Access Token stage.

WithVersion ( string version ) : OAuthRequestWrapper

Set the version of OAuth being used.

This is equivalent to setting OAuthRequestWrapper.OAuthVersion. If this is not set, then "1.0" is used.

Приватные методы

Метод Описание
OAuthRequestWrapper ( WebRequest toContain ) : System

There is only one constructor, and the OAuthRequestWrapper can only be instantiated internally to the library.

createAuthorization ( ) : void
createSignature ( ) : void

Описание методов

InHeader() публичный Метод

Complete the request signing and add the OAuth information to the Authorization header.
This must be your last step in the function chain.
public InHeader ( ) : void
Результат void

WithCallback() публичный Метод

Set the callback address that the OAuth Request Token stage should use.
The oauth_callback is sometimes required at the Request Token stage in a three-legged OAuth login request. It is possible to set this for other request, but may be unexpected and cause issues.
public WithCallback ( string callbackUrl ) : OAuthRequestWrapper
callbackUrl string An address or some other string to pass as the OAuth callback.
Результат OAuthRequestWrapper

WithEncryption() публичный Метод

Set the encryption method that should be used for this request.
This is equivalent to setting OAuthRequestWrapper.SigningMethod. If it is not set, the default is to use EncryptionMethod.HMACSHA1.
public WithEncryption ( EncryptionMethod enc ) : OAuthRequestWrapper
enc EncryptionMethod A
Результат OAuthRequestWrapper

WithPostParameters() публичный Метод

Provide the POST request to generate a valid OAuth signature.
The OAuth standard requires POST parameters sent in application/x-www-form-urlencoded requests to be included in the OAuth base string to create a valid signature. If it is not provided, then the request will fail. If this is set, then the WebRequest.ContentType of the OAuthRequestWrapper.ContainedRequest will be set to 'application/x-www-form-urlencoded' if it is not already set.
public WithPostParameters ( string parameters ) : OAuthRequestWrapper
parameters string The POST parameters that will be sent.
Результат OAuthRequestWrapper

WithTokens() публичный Метод

Set the tokens that should be used for this request.
This is equivalent to setting OAuthRequestWrapper.RequestTokens.
public WithTokens ( SimpleOAuth.Tokens oauthTokens ) : OAuthRequestWrapper
oauthTokens SimpleOAuth.Tokens A object containing the Consumer and/or Access tokens.
Результат OAuthRequestWrapper

WithVerifier() публичный Метод

Set the oauth_verifier in the OAuth Access Token stage.
public WithVerifier ( string verifier ) : OAuthRequestWrapper
verifier string The oauth_verifier string used to verify the request.
Результат OAuthRequestWrapper

WithVersion() публичный Метод

Set the version of OAuth being used.
This is equivalent to setting OAuthRequestWrapper.OAuthVersion. If this is not set, then "1.0" is used.
public WithVersion ( string version ) : OAuthRequestWrapper
version string The version number to use.
Результат OAuthRequestWrapper