Beispiel #1
0
 /// <summary>
 /// Converts an OAuthVersion enum to a string representation.
 /// </summary>
 public static string GetOAuthVersionAsString(OAuthVersion version)
 {
     return(version == OAuthVersion.OneZeroA ? // is it 1.0a?
            Constants.oauth_version_1a :
            version == OAuthVersion.OneZero ?  // is it 1.0?
            Constants.oauth_version_1 :
            string.Empty);                     // not specified.
 }
Beispiel #2
0
 public async Task <string> ComputeOAuthVersionAsync(HttpRequestMessage request, string nonce, string timestamp, OAuthVersion version)
 {
     using (OAuthMessageHandler msgHandler = new OAuthMessageHandler(
                _apiKey,
                _clientSecret,
                _authToken,
                _authTokenSecret,
                new TestOAuthProvider(
                    nonce,
                    timestamp,
                    version)))
     {
         return(await GetOAuthParameterFromHandlerAsync(msgHandler, request, "oauth_version"));
     }
 }
Beispiel #3
0
 public OAuthSignatureDataProvider(OAuthVersion oauthVersion)
 {
     _oauthVersion = OAuth.Helpers.OAuthHelpers.GetOAuthVersionAsString(oauthVersion);
 }
 public OAuthAuthenticator(string apiKey, string secret, OAuthVersion oauthVersion)
 {
     _apiKey       = apiKey;
     _secret       = secret;
     _oauthVersion = OAuthHelpers.GetOAuthVersionAsString(oauthVersion);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="version"></param>
 /// <param name="title"></param>
 /// <param name="message"></param>
 /// <param name="ex"></param>
 public WeChatOAuthException(OAuthVersion version, string title, string message, Exception ex = null)
     : base($"{title} : {message}", ex)
 {
     Version = version;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="version"></param>
 /// <param name="message"></param>
 /// <param name="ex"></param>
 public WeChatOAuthException(OAuthVersion version, string message, Exception ex = null)
     : base(message, ex)
 {
     Version = version;
 }
Beispiel #7
0
 public TestOAuthProvider(string nonce, string timestamp, OAuthVersion version)
 {
     _nonce        = nonce;
     _timestamp    = timestamp;
     _oauthVersion = OAuth.Helpers.OAuthHelpers.GetOAuthVersionAsString(version);
 }
Beispiel #8
0
 public OAuthMessageHandler(string apiKey, string secret, string authToken, string authTokenSecret, OAuthVersion oauthVersion) :
     this(apiKey, secret, authToken, authTokenSecret, new OAuthSignatureDataProvider(oauthVersion))
 {
 }