/// <summary> /// Create an authenticator to authenticate the client /// </summary> /// <param name="consumerKey">The consumer key</param> /// <param name="consumerSecret">The consumer secret</param> /// <param name="username">The client user name</param> /// <param name="password">The client password</param> /// <returns>The new authenticator</returns> public static OAuth1Authenticator ForClientAuthentication(string consumerKey, string consumerSecret, string username, string password) { var authenticator = new OAuth1Authenticator { ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader, SignatureProvider = new HmacSha1SignatureProvider(), SignatureTreatment = OAuthSignatureTreatment.Escaped, ConsumerKey = consumerKey, ConsumerSecret = consumerSecret, ClientUsername = username, ClientPassword = password, Type = OAuthType.ClientAuthentication }; return authenticator; }
/// <summary> /// Create an authenticator to access a protected resource /// </summary> /// <param name="consumerKey">The consumer key</param> /// <param name="consumerSecret">The consumer secret</param> /// <param name="accessToken">The access token</param> /// <param name="accessTokenSecret">The access token secret</param> /// <returns>The new authenticator</returns> public static OAuth1Authenticator ForProtectedResource(string consumerKey, string consumerSecret, string accessToken, string accessTokenSecret) { var authenticator = new OAuth1Authenticator { Type = OAuthType.ProtectedResource, ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader, SignatureProvider = new HmacSha1SignatureProvider(), SignatureTreatment = OAuthSignatureTreatment.Escaped, ConsumerKey = consumerKey, ConsumerSecret = consumerSecret, Token = accessToken, TokenSecret = accessTokenSecret }; return authenticator; }
/// <summary> /// Create an authenticator to gather an access token /// </summary> /// <param name="consumerKey">The consumer key</param> /// <param name="consumerSecret">The consumer secret</param> /// <param name="token">The access token</param> /// <param name="tokenSecret">The access token secret</param> /// <returns>The new authenticator</returns> public static OAuth1Authenticator ForAccessToken(string consumerKey, string consumerSecret, string token, string tokenSecret) { var authenticator = new OAuth1Authenticator { ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader, SignatureProvider = new HmacSha1SignatureProvider(), SignatureTreatment = OAuthSignatureTreatment.Escaped, ConsumerKey = consumerKey, ConsumerSecret = consumerSecret, Token = token, TokenSecret = tokenSecret, Type = OAuthType.AccessToken }; return authenticator; }