C# Class 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.
ファイルを表示 Open project: cbenard/SimpleOAuth.Net

Private Properties

Property Type Description
OAuthRequestWrapper System
createAuthorization void
createSignature void

Public Methods

Method Description
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.

Private Methods

Method Description
OAuthRequestWrapper ( WebRequest toContain ) : System

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

createAuthorization ( ) : void
createSignature ( ) : void

Method Details

InHeader() public method

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
return void

WithCallback() public method

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.
return OAuthRequestWrapper

WithEncryption() public method

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
return OAuthRequestWrapper

WithPostParameters() public method

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.
return OAuthRequestWrapper

WithTokens() public method

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.
return OAuthRequestWrapper

WithVerifier() public method

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.
return OAuthRequestWrapper

WithVersion() public method

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.
return OAuthRequestWrapper