public override IDirectedProtocolMessage GetNewRequestMessage(MessageReceivingEndpoint recipient, IDictionary<string, string> fields) {
			var message = base.GetNewRequestMessage(recipient, fields);

			// inject our own type here to replace the standard one
			if (message is UnauthorizedTokenRequest) {
				message = new RequestScopedTokenMessage(recipient, message.Version);
			}

			return message;
		}
        public override IDirectedProtocolMessage GetNewRequestMessage(MessageReceivingEndpoint recipient, IDictionary <string, string> fields)
        {
            var message = base.GetNewRequestMessage(recipient, fields);

            // inject our own type here to replace the standard one
            if (message is UnauthorizedTokenRequest)
            {
                message = new RequestScopedTokenMessage(recipient, message.Version);
            }

            return(message);
        }
Beispiel #3
0
        public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response)
        {
            RequestScopedTokenMessage scopedRequest = (RequestScopedTokenMessage)request;
            var        consumer = Global.DataContext.OAuthConsumers.Single(consumerRow => consumerRow.ConsumerKey == request.ConsumerKey);
            string     scope    = scopedRequest.Scope;
            OAuthToken newToken = new OAuthToken {
                OAuthConsumer = consumer,
                Token         = response.Token,
                TokenSecret   = response.TokenSecret,
                IssueDate     = DateTime.UtcNow,
                Scope         = scope,
            };

            Global.DataContext.OAuthTokens.InsertOnSubmit(newToken);
            Global.DataContext.SubmitChanges();
        }