internal static UnauthorizedTokenRequest CreateTestRequestTokenMessage(MessageDescriptionCollection messageDescriptions, MessageReceivingEndpoint endpoint) { endpoint = endpoint ?? new MessageReceivingEndpoint("https://www.google.com/accounts/OAuthGetRequestToken", HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest); UnauthorizedTokenRequest message = new UnauthorizedTokenRequest(endpoint, Protocol.V10.Version); message.ConsumerKey = "nerdbank.org"; ((ITamperResistantOAuthMessage)message).ConsumerSecret = "nerdbanksecret"; var signedMessage = (ITamperResistantOAuthMessage)message; signedMessage.HttpMethod = "GET"; signedMessage.SignatureMethod = "HMAC-SHA1"; MessageDictionary dictionary = messageDescriptions.GetAccessor(message); dictionary["oauth_timestamp"] = "1222665749"; dictionary["oauth_nonce"] = "fe4045a3f0efdd1e019fa8f8ae3f5c38"; dictionary["scope"] = "http://www.google.com/m8/feeds/"; return message; }
internal static UnauthorizedTokenRequest CreateTestRequestTokenMessageNoOAuthVersion(MessageDescriptionCollection messageDescriptions, MessageReceivingEndpoint endpoint) { endpoint = endpoint ?? new MessageReceivingEndpoint("https://www.google.com/accounts/OAuthGetRequestToken", HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest); var parts = new Dictionary<string, string>(); parts["oauth_consumer_key"] = "nerdbank.org"; parts["oauth_timestamp"] = "1222665749"; parts["oauth_nonce"] = "fe4045a3f0efdd1e019fa8f8ae3f5c38"; parts["scope"] = "http://www.google.com/m8/feeds/"; parts["oauth_signature_method"] = "HMAC-SHA1"; parts["oauth_signature"] = "anything non-empty"; UnauthorizedTokenRequest message = new UnauthorizedTokenRequest(endpoint, Protocol.V10.Version); MessageDictionary dictionary = messageDescriptions.GetAccessor(message); MessageSerializer.Get(typeof(UnauthorizedTokenRequest)).Deserialize(parts, dictionary); return message; }