protected AccessTokenRequest(Uri requestUri, ClientCredentials credentials, NegotiationToken negociationToken, string verifierCode) { this.requestUri = requestUri; this.clientCredentials = credentials; this.negotiationToken = negociationToken; this.verifierCode = verifierCode; }
public void WithToken() { ClientCredentials credentials = new ClientCredentials("key", "secret"); NegotiationToken token = new NegotiationToken("requestkey", "requestsecret"); string baseString = "POST&http%3A%2F%2Fterm.ie%2Foauth%2Fexample%2Faccess_token.php&oauth_consumer_key%3Dkey%26oauth_nonce%3D6971488%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1327336019%26oauth_token%3Drequestkey%26oauth_version%3D1.0"; Signature signature = new HmacSha1Signature(baseString, credentials, token); Assert.AreEqual("HMAC-SHA1", signature.Method); Assert.AreEqual("TtSu4YZhB3uuWPwmCetVARH5f7c%3D", signature.Value); }
public static Uri Create(Uri authorize, NegotiationToken negotiationToken) { UriBuilder builder = new UriBuilder(authorize); if (QueryStringContainsParameters(builder.Query)) { builder.Query = builder.Query.Substring(1) + "&" + OAuthTokenParameter(negotiationToken); } else { builder.Query = OAuthTokenParameter(negotiationToken); } return builder.Uri; }
private static string OAuthTokenParameter(NegotiationToken negotiationToken) { return AuthorizationHeaderFields.TOKEN + "=" + negotiationToken.Value; }
public static Uri Create(string authorize, NegotiationToken negotiationToken) { return Create(new Uri(authorize), negotiationToken); }
public static AccessTokenRequest Create(Uri requestUri, ClientCredentials credentials, NegotiationToken negociationToken) { return new AccessTokenRequest(requestUri, credentials, negociationToken, ""); }
public static AccessTokenRequest Create(Uri requestUri, ClientCredentials credentials, NegotiationToken negociationToken, string verifierCode) { return new AccessTokenRequest(requestUri, credentials, negociationToken, verifierCode); }