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;
		}
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 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();
        }