C# Class WeiranZhang.InstapaperAPI.OAuthHelper

显示文件 Open project: weiran/Metropaper

Public Methods

Method Description
GetNonce ( ) : string

Generates a random 16-byte lowercase alphanumeric string.

GetSignature ( string signatureBase, string consumerSecret, string tokenSecret ) : string

Creates a signature value given a signature base and the consumer secret and a known token secret.

GetTimestamp ( ) : string

Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT"

GetTimestamp ( System.DateTime dateTime ) : string

Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT"

UrlEncodeRelaxed ( string value ) : string

URL encodes a string based on section 5.1 of the OAuth spec. Namely, percent encoding with [RFC3986], avoiding unreserved characters, upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs.

The Uri.EscapeDataString method is supposed to take on RFC 3986 behavior if certain elements are present in a .config file. Even if this actually worked (which in my experiments it doesn't), we can't rely on every host actually having this configuration element present.

Private Methods

Method Description
OAuthHelper ( ) : System

Method Details

GetNonce() public static method

Generates a random 16-byte lowercase alphanumeric string.
public static GetNonce ( ) : string
return string

GetSignature() public static method

Creates a signature value given a signature base and the consumer secret and a known token secret.
public static GetSignature ( string signatureBase, string consumerSecret, string tokenSecret ) : string
signatureBase string The signature base
consumerSecret string The consumer secret
tokenSecret string The token secret
return string

GetTimestamp() public static method

Generates a timestamp based on the current elapsed seconds since '01/01/1970 0000 GMT"
public static GetTimestamp ( ) : string
return string

GetTimestamp() public static method

Generates a timestamp based on the elapsed seconds of a given time since '01/01/1970 0000 GMT"
public static GetTimestamp ( System.DateTime dateTime ) : string
dateTime System.DateTime A specified point in time.
return string

UrlEncodeRelaxed() public static method

URL encodes a string based on section 5.1 of the OAuth spec. Namely, percent encoding with [RFC3986], avoiding unreserved characters, upper-casing hexadecimal characters, and UTF-8 encoding for text value pairs.
The Uri.EscapeDataString method is supposed to take on RFC 3986 behavior if certain elements are present in a .config file. Even if this actually worked (which in my experiments it doesn't), we can't rely on every host actually having this configuration element present.
public static UrlEncodeRelaxed ( string value ) : string
value string The value to escape.
return string