diff options
29 files changed, 214 insertions, 167 deletions
diff --git a/samples/Consumer/App_Code/InMemoryTokenManager.cs b/samples/Consumer/App_Code/InMemoryTokenManager.cs index 89400c0..7312c2e 100644 --- a/samples/Consumer/App_Code/InMemoryTokenManager.cs +++ b/samples/Consumer/App_Code/InMemoryTokenManager.cs @@ -36,7 +36,7 @@ public class InMemoryTokenManager : ITokenManager { return this.tokensAndSecrets[token];
}
- public void StoreNewRequestToken(GetRequestTokenMessage request, ITokenSecretContainingMessage response) {
+ public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
this.tokensAndSecrets[response.Token] = response.TokenSecret;
}
diff --git a/samples/ConsumerWpf/InMemoryTokenManager.cs b/samples/ConsumerWpf/InMemoryTokenManager.cs index 5be2626..b29d2e0 100644 --- a/samples/ConsumerWpf/InMemoryTokenManager.cs +++ b/samples/ConsumerWpf/InMemoryTokenManager.cs @@ -35,7 +35,7 @@ namespace DotNetOAuth.Samples.ConsumerWpf { return this.tokensAndSecrets[token];
}
- public void StoreNewRequestToken(GetRequestTokenMessage request, ITokenSecretContainingMessage response) {
+ public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
this.tokensAndSecrets[response.Token] = response.TokenSecret;
}
diff --git a/samples/ServiceProvider/App_Code/CustomOAuthTypeProvider.cs b/samples/ServiceProvider/App_Code/CustomOAuthTypeProvider.cs index c1773a5..98eae68 100644 --- a/samples/ServiceProvider/App_Code/CustomOAuthTypeProvider.cs +++ b/samples/ServiceProvider/App_Code/CustomOAuthTypeProvider.cs @@ -21,7 +21,7 @@ public class CustomOAuthTypeProvider : OAuthServiceProviderMessageTypeProvider { Type type = base.GetRequestMessageType(fields);
// inject our own type here to replace the standard one
- if (type == typeof(GetRequestTokenMessage)) {
+ if (type == typeof(UnauthorizedTokenRequest)) {
type = typeof(RequestScopedTokenMessage);
}
diff --git a/samples/ServiceProvider/App_Code/DatabaseTokenManager.cs b/samples/ServiceProvider/App_Code/DatabaseTokenManager.cs index f5f7d39..2a0e265 100644 --- a/samples/ServiceProvider/App_Code/DatabaseTokenManager.cs +++ b/samples/ServiceProvider/App_Code/DatabaseTokenManager.cs @@ -34,7 +34,7 @@ public class DatabaseTokenManager : ITokenManager { return tokenRow.TokenSecret;
}
- public void StoreNewRequestToken(GetRequestTokenMessage request, ITokenSecretContainingMessage response) {
+ 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;
diff --git a/samples/ServiceProvider/App_Code/Global.cs b/samples/ServiceProvider/App_Code/Global.cs index 7e8d92d..aa0d738 100644 --- a/samples/ServiceProvider/App_Code/Global.cs +++ b/samples/ServiceProvider/App_Code/Global.cs @@ -42,8 +42,8 @@ public class Global : HttpApplication { get { return Global.DataContext.Users.SingleOrDefault(user => user.OpenIDClaimedIdentifier == HttpContext.Current.User.Identity.Name); }
}
- public static DirectUserToServiceProviderMessage PendingOAuthAuthorization {
- get { return HttpContext.Current.Session["authrequest"] as DirectUserToServiceProviderMessage; }
+ public static UserAuthorizationRequest PendingOAuthAuthorization {
+ get { return HttpContext.Current.Session["authrequest"] as UserAuthorizationRequest; }
set { HttpContext.Current.Session["authrequest"] = value; }
}
diff --git a/samples/ServiceProvider/App_Code/RequestScopedTokenMessage.cs b/samples/ServiceProvider/App_Code/RequestScopedTokenMessage.cs index afd35c9..fa23dc2 100644 --- a/samples/ServiceProvider/App_Code/RequestScopedTokenMessage.cs +++ b/samples/ServiceProvider/App_Code/RequestScopedTokenMessage.cs @@ -4,7 +4,7 @@ using DotNetOAuth.Messaging; /// <summary>
/// A custom web app version of the message sent to request an unauthorized token.
/// </summary>
-public class RequestScopedTokenMessage : GetRequestTokenMessage {
+public class RequestScopedTokenMessage : UnauthorizedTokenRequest {
/// <summary>
/// Initializes a new instance of the <see cref="RequestScopedTokenMessage"/> class.
/// </summary>
diff --git a/samples/ServiceProvider/OAuth.ashx b/samples/ServiceProvider/OAuth.ashx index 6de26ef..2577b9a 100644 --- a/samples/ServiceProvider/OAuth.ashx +++ b/samples/ServiceProvider/OAuth.ashx @@ -19,15 +19,15 @@ public class OAuth : IHttpHandler, IRequiresSessionState { public void ProcessRequest(HttpContext context) {
IProtocolMessage request = sp.ReadRequest();
RequestScopedTokenMessage requestToken;
- DirectUserToServiceProviderMessage requestAuth;
- GetAccessTokenMessage requestAccessToken;
+ UserAuthorizationRequest requestAuth;
+ AuthorizedTokenRequest requestAccessToken;
if ((requestToken = request as RequestScopedTokenMessage) != null) {
var response = sp.PrepareUnauthorizedTokenMessage(requestToken);
sp.Channel.Send(response).Send();
- } else if ((requestAuth = request as DirectUserToServiceProviderMessage) != null) {
+ } else if ((requestAuth = request as UserAuthorizationRequest) != null) {
Global.PendingOAuthAuthorization = requestAuth;
HttpContext.Current.Response.Redirect("~/Members/Authorize.aspx");
- } else if ((requestAccessToken = request as GetAccessTokenMessage) != null) {
+ } else if ((requestAccessToken = request as AuthorizedTokenRequest) != null) {
var response = sp.PrepareAccessTokenMessage(requestAccessToken);
sp.Channel.Send(response).Send();
} else {
diff --git a/src/DotNetOAuth.Test/ChannelElements/HmacSha1SigningBindingElementTests.cs b/src/DotNetOAuth.Test/ChannelElements/HmacSha1SigningBindingElementTests.cs index ec6f71f..02e11f8 100644 --- a/src/DotNetOAuth.Test/ChannelElements/HmacSha1SigningBindingElementTests.cs +++ b/src/DotNetOAuth.Test/ChannelElements/HmacSha1SigningBindingElementTests.cs @@ -13,7 +13,7 @@ namespace DotNetOAuth.Test.ChannelElements { public class HmacSha1SigningBindingElementTests : MessagingTestBase {
[TestMethod]
public void SignatureTest() {
- GetRequestTokenMessage message = SigningBindingElementBaseTests.CreateTestRequestTokenMessage();
+ UnauthorizedTokenRequest message = SigningBindingElementBaseTests.CreateTestRequestTokenMessage();
HmacSha1SigningBindingElement_Accessor hmac = new HmacSha1SigningBindingElement_Accessor();
Assert.AreEqual("kR0LhH8UqylaLfR/esXVVlP4sQI=", hmac.GetSignature(message));
diff --git a/src/DotNetOAuth.Test/ChannelElements/PlaintextSigningBindingElementTest.cs b/src/DotNetOAuth.Test/ChannelElements/PlaintextSigningBindingElementTest.cs index 7bf9e63..2dea446 100644 --- a/src/DotNetOAuth.Test/ChannelElements/PlaintextSigningBindingElementTest.cs +++ b/src/DotNetOAuth.Test/ChannelElements/PlaintextSigningBindingElementTest.cs @@ -17,7 +17,7 @@ namespace DotNetOAuth.Test.ChannelElements public void HttpsSignatureGeneration() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://localtest", HttpDeliveryMethods.GetRequest);
- ITamperResistantOAuthMessage message = new GetRequestTokenMessage(endpoint);
+ ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint);
message.ConsumerSecret = "cs";
message.TokenSecret = "ts";
Assert.IsTrue(target.PrepareMessageForSending(message));
@@ -29,7 +29,7 @@ namespace DotNetOAuth.Test.ChannelElements public void HttpsSignatureVerification() {
MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://localtest", HttpDeliveryMethods.GetRequest);
ITamperProtectionChannelBindingElement target = new PlaintextSigningBindingElement();
- ITamperResistantOAuthMessage message = new GetRequestTokenMessage(endpoint);
+ ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint);
message.ConsumerSecret = "cs";
message.TokenSecret = "ts";
message.SignatureMethod = "PLAINTEXT";
@@ -41,7 +41,7 @@ namespace DotNetOAuth.Test.ChannelElements public void HttpsSignatureVerificationNotApplicable() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://localtest", HttpDeliveryMethods.GetRequest);
- ITamperResistantOAuthMessage message = new GetRequestTokenMessage(endpoint);
+ ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint);
message.ConsumerSecret = "cs";
message.TokenSecret = "ts";
message.SignatureMethod = "ANOTHERALGORITHM";
@@ -53,7 +53,7 @@ namespace DotNetOAuth.Test.ChannelElements public void HttpSignatureGeneration() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("http://localtest", HttpDeliveryMethods.GetRequest);
- ITamperResistantOAuthMessage message = new GetRequestTokenMessage(endpoint);
+ ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint);
message.ConsumerSecret = "cs";
message.TokenSecret = "ts";
@@ -67,7 +67,7 @@ namespace DotNetOAuth.Test.ChannelElements public void HttpSignatureVerification() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("http://localtest", HttpDeliveryMethods.GetRequest);
- ITamperResistantOAuthMessage message = new GetRequestTokenMessage(endpoint);
+ ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint);
message.ConsumerSecret = "cs";
message.TokenSecret = "ts";
message.SignatureMethod = "PLAINTEXT";
diff --git a/src/DotNetOAuth.Test/ChannelElements/SigningBindingElementBaseTests.cs b/src/DotNetOAuth.Test/ChannelElements/SigningBindingElementBaseTests.cs index 6759bc6..4d1f8f0 100644 --- a/src/DotNetOAuth.Test/ChannelElements/SigningBindingElementBaseTests.cs +++ b/src/DotNetOAuth.Test/ChannelElements/SigningBindingElementBaseTests.cs @@ -15,16 +15,16 @@ namespace DotNetOAuth.Test.ChannelElements { public class SigningBindingElementBaseTests : MessagingTestBase {
[TestMethod]
public void BaseSignatureStringTest() {
- GetRequestTokenMessage message = CreateTestRequestTokenMessage();
+ UnauthorizedTokenRequest message = CreateTestRequestTokenMessage();
Assert.AreEqual(
"GET&https%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthGetRequestToken&oauth_consumer_key%3Dnerdbank.org%26oauth_nonce%3Dfe4045a3f0efdd1e019fa8f8ae3f5c38%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1222665749%26oauth_version%3D1.0%26scope%3Dhttp%253A%252F%252Fwww.google.com%252Fm8%252Ffeeds%252F",
SigningBindingElementBase_Accessor.ConstructSignatureBaseString(message));
}
- internal static GetRequestTokenMessage CreateTestRequestTokenMessage() {
+ internal static UnauthorizedTokenRequest CreateTestRequestTokenMessage() {
MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://www.google.com/accounts/OAuthGetRequestToken", HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest);
- GetRequestTokenMessage message = new GetRequestTokenMessage(endpoint);
+ UnauthorizedTokenRequest message = new UnauthorizedTokenRequest(endpoint);
message.ConsumerKey = "nerdbank.org";
((ITamperResistantOAuthMessage)message).ConsumerSecret = "nerdbanksecret";
var signedMessage = (ITamperResistantOAuthMessage)message;
diff --git a/src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs b/src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs index 5713707..dffc098 100644 --- a/src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs +++ b/src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs @@ -35,7 +35,7 @@ namespace DotNetOAuth.Test.Mocks { return this.tokensAndSecrets[token];
}
- public void StoreNewRequestToken(GetRequestTokenMessage request, ITokenSecretContainingMessage response) {
+ public void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
this.tokensAndSecrets[response.Token] = response.TokenSecret;
this.requestTokens.Add(response.Token, false);
}
diff --git a/src/DotNetOAuth.Test/Scenarios/CoordinatingOAuthChannel.cs b/src/DotNetOAuth.Test/Scenarios/CoordinatingOAuthChannel.cs index 60f216e..d053a11 100644 --- a/src/DotNetOAuth.Test/Scenarios/CoordinatingOAuthChannel.cs +++ b/src/DotNetOAuth.Test/Scenarios/CoordinatingOAuthChannel.cs @@ -45,7 +45,7 @@ namespace DotNetOAuth.Test.Scenarios { /// </summary>
internal CoordinatingOAuthChannel RemoteChannel { get; set; }
- internal Response RequestProtectedResource(AccessProtectedResourceMessage request) {
+ internal Response RequestProtectedResource(AccessProtectedResourceRequest request) {
((ITamperResistantOAuthMessage)request).HttpMethod = this.GetHttpMethod(((ITamperResistantOAuthMessage)request).HttpMethods);
this.PrepareMessageForSending(request);
HttpRequestInfo requestInfo = this.SpoofHttpMethod(request);
diff --git a/src/DotNetOAuth/ChannelElements/ITokenManager.cs b/src/DotNetOAuth/ChannelElements/ITokenManager.cs index 878f176..af22d7c 100644 --- a/src/DotNetOAuth/ChannelElements/ITokenManager.cs +++ b/src/DotNetOAuth/ChannelElements/ITokenManager.cs @@ -42,7 +42,7 @@ namespace DotNetOAuth.ChannelElements { /// <param name="request">The request message that resulted in the generation of a new unauthorized request token.</param>
/// <param name="response">The response message that includes the unauthorized request token.</param>
/// <exception cref="ArgumentException">Thrown if the consumer key is not registered, or a required parameter was not found in the parameters collection.</exception>
- void StoreNewRequestToken(GetRequestTokenMessage request, ITokenSecretContainingMessage response);
+ void StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response);
/// <summary>
/// Checks whether a given request token has already been authorized
diff --git a/src/DotNetOAuth/ChannelElements/OAuthConsumerMessageTypeProvider.cs b/src/DotNetOAuth/ChannelElements/OAuthConsumerMessageTypeProvider.cs index 1bb255e..b628527 100644 --- a/src/DotNetOAuth/ChannelElements/OAuthConsumerMessageTypeProvider.cs +++ b/src/DotNetOAuth/ChannelElements/OAuthConsumerMessageTypeProvider.cs @@ -30,7 +30,7 @@ namespace DotNetOAuth.ChannelElements { /// <param name="fields">The name/value pairs that make up the message payload.</param>
/// <remarks>
/// The request messages are:
- /// DirectUserToConsumerMessage
+ /// UserAuthorizationResponse
/// </remarks>
/// <returns>
/// The <see cref="IProtocolMessage"/>-derived concrete class that this message can
@@ -42,7 +42,7 @@ namespace DotNetOAuth.ChannelElements { }
if (fields.ContainsKey("oauth_token")) {
- return typeof(DirectUserToConsumerMessage);
+ return typeof(UserAuthorizationResponse);
}
return null;
@@ -63,8 +63,8 @@ namespace DotNetOAuth.ChannelElements { /// </returns>
/// <remarks>
/// The response messages are:
- /// GrantRequestTokenMessage
- /// GrantAccessTokenMessage
+ /// UnauthorizedTokenResponse
+ /// AuthorizedTokenResponse
/// </remarks>
public virtual Type GetResponseMessageType(IProtocolMessage request, IDictionary<string, string> fields) {
if (fields == null) {
@@ -82,10 +82,10 @@ namespace DotNetOAuth.ChannelElements { return null;
}
- if (request is GetRequestTokenMessage) {
- return typeof(GrantRequestTokenMessage);
- } else if (request is GetAccessTokenMessage) {
- return typeof(GrantAccessTokenMessage);
+ if (request is UnauthorizedTokenRequest) {
+ return typeof(UnauthorizedTokenResponse);
+ } else if (request is AuthorizedTokenRequest) {
+ return typeof(AuthorizedTokenResponse);
} else {
Logger.ErrorFormat("Unexpected response message given the request type {0}", request.GetType().Name);
throw new ProtocolException(Strings.InvalidIncomingMessage);
diff --git a/src/DotNetOAuth/ChannelElements/OAuthServiceProviderMessageTypeProvider.cs b/src/DotNetOAuth/ChannelElements/OAuthServiceProviderMessageTypeProvider.cs index 8632f0f..d056475 100644 --- a/src/DotNetOAuth/ChannelElements/OAuthServiceProviderMessageTypeProvider.cs +++ b/src/DotNetOAuth/ChannelElements/OAuthServiceProviderMessageTypeProvider.cs @@ -41,10 +41,10 @@ namespace DotNetOAuth.ChannelElements { /// <param name="fields">The name/value pairs that make up the message payload.</param>
/// <remarks>
/// The request messages are:
- /// GetRequestTokenMessage
- /// GetAccessTokenMessage
- /// DirectUserToServiceProviderMessage
- /// AccessProtectedResourceMessage
+ /// UnauthorizedTokenRequest
+ /// AuthorizedTokenRequest
+ /// UserAuthorizationRequest
+ /// AccessProtectedResourceRequest
/// </remarks>
/// <returns>
/// The <see cref="IProtocolMessage"/>-derived concrete class that this message can
@@ -57,7 +57,7 @@ namespace DotNetOAuth.ChannelElements { if (fields.ContainsKey("oauth_consumer_key") &&
!fields.ContainsKey("oauth_token")) {
- return typeof(GetRequestTokenMessage);
+ return typeof(UnauthorizedTokenRequest);
}
if (fields.ContainsKey("oauth_consumer_key") &&
@@ -67,12 +67,12 @@ namespace DotNetOAuth.ChannelElements { // is in the token parameter.
bool tokenTypeIsAccessToken = this.tokenManager.GetTokenType(fields["oauth_token"]) == TokenType.AccessToken;
- return tokenTypeIsAccessToken ? typeof(AccessProtectedResourceMessage) :
- typeof(GetAccessTokenMessage);
+ return tokenTypeIsAccessToken ? typeof(AccessProtectedResourceRequest) :
+ typeof(AuthorizedTokenRequest);
}
// fail over to the message with no required fields at all.
- return typeof(DirectUserToServiceProviderMessage);
+ return typeof(UserAuthorizationRequest);
}
/// <summary>
diff --git a/src/DotNetOAuth/ConsumerBase.cs b/src/DotNetOAuth/ConsumerBase.cs index 475f9aa..651a352 100644 --- a/src/DotNetOAuth/ConsumerBase.cs +++ b/src/DotNetOAuth/ConsumerBase.cs @@ -116,18 +116,18 @@ namespace DotNetOAuth { /// <param name="requestToken">The request token that must be exchanged for an access token after the user has provided authorization.</param>
/// <returns>The pending user agent redirect based message to be sent as an HttpResponse.</returns>
[SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "3#", Justification = "Two results")]
- protected internal DirectUserToServiceProviderMessage PrepareRequestUserAuthorization(Uri callback, IDictionary<string, string> requestParameters, IDictionary<string, string> redirectParameters, out string requestToken) {
+ protected internal UserAuthorizationRequest PrepareRequestUserAuthorization(Uri callback, IDictionary<string, string> requestParameters, IDictionary<string, string> redirectParameters, out string requestToken) {
// Obtain an unauthorized request token.
- var token = new GetRequestTokenMessage(this.ServiceProvider.RequestTokenEndpoint) {
+ var token = new UnauthorizedTokenRequest(this.ServiceProvider.RequestTokenEndpoint) {
ConsumerKey = this.ConsumerKey,
};
token.AddNonOAuthParameters(requestParameters);
- var requestTokenResponse = this.Channel.Request<GrantRequestTokenMessage>(token);
+ var requestTokenResponse = this.Channel.Request<UnauthorizedTokenResponse>(token);
this.TokenManager.StoreNewRequestToken(token, requestTokenResponse);
// Request user authorization.
ITokenContainingMessage assignedRequestToken = requestTokenResponse;
- var requestAuthorization = new DirectUserToServiceProviderMessage(this.ServiceProvider.UserAuthorizationEndpoint, assignedRequestToken.Token) {
+ var requestAuthorization = new UserAuthorizationRequest(this.ServiceProvider.UserAuthorizationEndpoint, assignedRequestToken.Token) {
Callback = callback,
};
requestAuthorization.AddNonOAuthParameters(redirectParameters);
@@ -142,7 +142,7 @@ namespace DotNetOAuth { /// <param name="endpoint">The URL and method on the Service Provider to send the request to.</param>
/// <param name="accessToken">The access token that permits access to the protected resource.</param>
/// <returns>The initialized WebRequest object.</returns>
- protected internal AccessProtectedResourceMessage CreateAuthorizingMessage(MessageReceivingEndpoint endpoint, string accessToken) {
+ protected internal AccessProtectedResourceRequest CreateAuthorizingMessage(MessageReceivingEndpoint endpoint, string accessToken) {
if (endpoint == null) {
throw new ArgumentNullException("endpoint");
}
@@ -150,7 +150,7 @@ namespace DotNetOAuth { throw new ArgumentNullException("accessToken");
}
- AccessProtectedResourceMessage message = new AccessProtectedResourceMessage(endpoint) {
+ AccessProtectedResourceRequest message = new AccessProtectedResourceRequest(endpoint) {
AccessToken = accessToken,
ConsumerKey = this.ConsumerKey,
};
@@ -163,12 +163,12 @@ namespace DotNetOAuth { /// </summary>
/// <param name="requestToken">The request token that the user has authorized.</param>
/// <returns>The access token assigned by the Service Provider.</returns>
- protected GrantAccessTokenMessage ProcessUserAuthorization(string requestToken) {
- var requestAccess = new GetAccessTokenMessage(this.ServiceProvider.AccessTokenEndpoint) {
+ protected AuthorizedTokenResponse ProcessUserAuthorization(string requestToken) {
+ var requestAccess = new AuthorizedTokenRequest(this.ServiceProvider.AccessTokenEndpoint) {
RequestToken = requestToken,
ConsumerKey = this.ConsumerKey,
};
- var grantAccess = this.Channel.Request<GrantAccessTokenMessage>(requestAccess);
+ var grantAccess = this.Channel.Request<AuthorizedTokenResponse>(requestAccess);
this.TokenManager.ExpireRequestTokenAndStoreNewAccessToken(this.ConsumerKey, requestToken, grantAccess.AccessToken, grantAccess.TokenSecret);
return grantAccess;
}
diff --git a/src/DotNetOAuth/DesktopConsumer.cs b/src/DotNetOAuth/DesktopConsumer.cs index 7b9ef49..f98b4b4 100644 --- a/src/DotNetOAuth/DesktopConsumer.cs +++ b/src/DotNetOAuth/DesktopConsumer.cs @@ -48,7 +48,7 @@ namespace DotNetOAuth { /// </summary>
/// <param name="requestToken">The request token that the user has authorized.</param>
/// <returns>The access token assigned by the Service Provider.</returns>
- public new GrantAccessTokenMessage ProcessUserAuthorization(string requestToken) {
+ public new AuthorizedTokenResponse ProcessUserAuthorization(string requestToken) {
return base.ProcessUserAuthorization(requestToken);
}
}
diff --git a/src/DotNetOAuth/DotNetOAuth.csproj b/src/DotNetOAuth/DotNetOAuth.csproj index 4e1373a..742a34b 100644 --- a/src/DotNetOAuth/DotNetOAuth.csproj +++ b/src/DotNetOAuth/DotNetOAuth.csproj @@ -84,7 +84,7 @@ <Compile Include="ChannelElements\IWebRequestHandler.cs" />
<Compile Include="ChannelElements\ITamperResistantOAuthMessage.cs" />
<Compile Include="Messages\MessageBase.cs" />
- <Compile Include="Messages\GetAccessTokenMessage.cs" />
+ <Compile Include="Messages\AuthorizedTokenRequest.cs" />
<Compile Include="Messaging\Bindings\INonceStore.cs" />
<Compile Include="Messaging\Bindings\StandardReplayProtectionBindingElement.cs" />
<Compile Include="Messaging\MessagePartAttribute.cs" />
@@ -95,12 +95,12 @@ <Compile Include="Messaging\Bindings\InvalidSignatureException.cs" />
<Compile Include="Messaging\Bindings\IReplayProtectedProtocolMessage.cs" />
<Compile Include="Messaging\Bindings\IExpiringProtocolMessage.cs" />
- <Compile Include="Messages\AccessProtectedResourceMessage.cs" />
- <Compile Include="Messages\GrantAccessTokenMessage.cs" />
+ <Compile Include="Messages\AccessProtectedResourceRequest.cs" />
+ <Compile Include="Messages\AuthorizedTokenResponse.cs" />
<Compile Include="ChannelElements\IOAuthDirectedMessage.cs" />
- <Compile Include="Messages\DirectUserToConsumerMessage.cs" />
- <Compile Include="Messages\DirectUserToServiceProviderMessage.cs" />
- <Compile Include="Messages\GrantRequestTokenMessage.cs" />
+ <Compile Include="Messages\UserAuthorizationResponse.cs" />
+ <Compile Include="Messages\UserAuthorizationRequest.cs" />
+ <Compile Include="Messages\UnauthorizedTokenResponse.cs" />
<Compile Include="Messaging\Channel.cs" />
<Compile Include="Messaging\HttpRequestInfo.cs" />
<Compile Include="Messaging\IDirectedProtocolMessage.cs" />
@@ -132,7 +132,7 @@ <Compile Include="ChannelElements\OAuthServiceProviderMessageTypeProvider.cs" />
<Compile Include="Messaging\ProtocolException.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Messages\GetRequestTokenMessage.cs" />
+ <Compile Include="Messages\UnauthorizedTokenRequest.cs" />
<Compile Include="ChannelElements\RsaSha1SigningBindingElement.cs" />
<Compile Include="ChannelElements\StandardWebRequestHandler.cs" />
<Compile Include="Messaging\MessageReceivingEndpoint.cs" />
diff --git a/src/DotNetOAuth/Messages/AccessProtectedResourceMessage.cs b/src/DotNetOAuth/Messages/AccessProtectedResourceRequest.cs index 0ff254b..e29f710 100644 --- a/src/DotNetOAuth/Messages/AccessProtectedResourceMessage.cs +++ b/src/DotNetOAuth/Messages/AccessProtectedResourceRequest.cs @@ -1,5 +1,5 @@ //-----------------------------------------------------------------------
-// <copyright file="AccessProtectedResourceMessage.cs" company="Andrew Arnott">
+// <copyright file="AccessProtectedResourceRequest.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
@@ -12,12 +12,12 @@ namespace DotNetOAuth.Messages { /// A message attached to a request for protected resources that provides the necessary
/// credentials to be granted access to those resources.
/// </summary>
- public class AccessProtectedResourceMessage : SignedMessageBase, ITokenContainingMessage {
+ public class AccessProtectedResourceRequest : SignedMessageBase, ITokenContainingMessage {
/// <summary>
- /// Initializes a new instance of the <see cref="AccessProtectedResourceMessage"/> class.
+ /// Initializes a new instance of the <see cref="AccessProtectedResourceRequest"/> class.
/// </summary>
/// <param name="serviceProvider">The URI of the Service Provider endpoint to send this message to.</param>
- protected internal AccessProtectedResourceMessage(MessageReceivingEndpoint serviceProvider)
+ protected internal AccessProtectedResourceRequest(MessageReceivingEndpoint serviceProvider)
: base(MessageTransport.Direct, serviceProvider) {
}
diff --git a/src/DotNetOAuth/Messages/GetAccessTokenMessage.cs b/src/DotNetOAuth/Messages/AuthorizedTokenRequest.cs index caa83d3..94ec6ff 100644 --- a/src/DotNetOAuth/Messages/GetAccessTokenMessage.cs +++ b/src/DotNetOAuth/Messages/AuthorizedTokenRequest.cs @@ -1,5 +1,5 @@ //-----------------------------------------------------------------------
-// <copyright file="GetAccessTokenMessage.cs" company="Andrew Arnott">
+// <copyright file="AuthorizedTokenRequest.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
@@ -15,12 +15,12 @@ namespace DotNetOAuth.Messages { /// <remarks>
/// The class is sealed because the OAuth spec forbids adding parameters to this message.
/// </remarks>
- public sealed class GetAccessTokenMessage : SignedMessageBase, ITokenContainingMessage {
+ public sealed class AuthorizedTokenRequest : SignedMessageBase, ITokenContainingMessage {
/// <summary>
- /// Initializes a new instance of the <see cref="GetAccessTokenMessage"/> class.
+ /// Initializes a new instance of the <see cref="AuthorizedTokenRequest"/> class.
/// </summary>
/// <param name="serviceProvider">The URI of the Service Provider endpoint to send this message to.</param>
- internal GetAccessTokenMessage(MessageReceivingEndpoint serviceProvider)
+ internal AuthorizedTokenRequest(MessageReceivingEndpoint serviceProvider)
: base(MessageTransport.Direct, serviceProvider) {
}
@@ -33,7 +33,7 @@ namespace DotNetOAuth.Messages { }
/// <summary>
- /// Gets or sets the Request Token.
+ /// Gets or sets the unauthorized Request Token used to obtain authorization.
/// </summary>
[MessagePart("oauth_token", IsRequired = true)]
internal string RequestToken { get; set; }
diff --git a/src/DotNetOAuth/Messages/GrantAccessTokenMessage.cs b/src/DotNetOAuth/Messages/AuthorizedTokenResponse.cs index 69823ae..5d0af27 100644 --- a/src/DotNetOAuth/Messages/GrantAccessTokenMessage.cs +++ b/src/DotNetOAuth/Messages/AuthorizedTokenResponse.cs @@ -1,5 +1,5 @@ //-----------------------------------------------------------------------
-// <copyright file="GrantAccessTokenMessage.cs" company="Andrew Arnott">
+// <copyright file="AuthorizedTokenResponse.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
@@ -11,13 +11,13 @@ namespace DotNetOAuth.Messages { /// <summary>
/// A direct message sent from Service Provider to Consumer in response to
- /// a Consumer's <see cref="GetAccessTokenMessage"/> request.
+ /// a Consumer's <see cref="AuthorizedTokenRequest"/> request.
/// </summary>
- public class GrantAccessTokenMessage : MessageBase, ITokenSecretContainingMessage {
+ public class AuthorizedTokenResponse : MessageBase, ITokenSecretContainingMessage {
/// <summary>
- /// Initializes a new instance of the <see cref="GrantAccessTokenMessage"/> class.
+ /// Initializes a new instance of the <see cref="AuthorizedTokenResponse"/> class.
/// </summary>
- protected internal GrantAccessTokenMessage()
+ protected internal AuthorizedTokenResponse()
: base(MessageProtections.None, MessageTransport.Direct) {
}
diff --git a/src/DotNetOAuth/Messages/OAuth Messages.cd b/src/DotNetOAuth/Messages/OAuth Messages.cd index a271247..5c5bfcc 100644 --- a/src/DotNetOAuth/Messages/OAuth Messages.cd +++ b/src/DotNetOAuth/Messages/OAuth Messages.cd @@ -6,84 +6,117 @@ <Comment CommentText="Messages from Consumer">
<Position X="4.36" Y="0.683" Height="0.291" Width="2.02" />
</Comment>
- <Class Name="DotNetOAuth.Messages.AccessProtectedResourceMessage">
- <Position X="3.75" Y="8.75" Width="3.5" />
- <InheritanceLine Type="DotNetOAuth.Messages.SignedMessageBase" ManuallyRouted="true" FixedToPoint="true">
+ <Class Name="DotNetOAuth.Messages.AccessProtectedResourceRequest">
+ <Position X="4.25" Y="7.75" Width="3" />
+ <Members>
+ <Property Name="ITokenContainingMessage.Token" Hidden="true" />
+ </Members>
+ <InheritanceLine Type="DotNetOAuth.Messages.SignedMessageBase" ManuallyRouted="true" FixedFromPoint="true" FixedToPoint="true">
<Path>
- <Point X="2.25" Y="6.588" />
- <Point X="2.25" Y="6.828" />
- <Point X="3.51" Y="6.828" />
- <Point X="3.51" Y="9.562" />
- <Point X="3.75" Y="9.562" />
+ <Point X="3.5" Y="5.626" />
+ <Point X="3.5" Y="8.25" />
+ <Point X="4.25" Y="8.25" />
</Path>
</InheritanceLine>
<TypeIdentifier>
<HashCode>AAAAAAACAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAA=</HashCode>
- <FileName>Messages\AccessProtectedResourceMessage.cs</FileName>
+ <FileName>Messages\AccessProtectedResourceRequest.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
- <Class Name="DotNetOAuth.Messages.GrantRequestTokenMessage">
+ <Class Name="DotNetOAuth.Messages.UnauthorizedTokenResponse">
<Position X="7.5" Y="1.5" Width="3" />
+ <Members>
+ <Property Name="ITokenContainingMessage.Token" Hidden="true" />
+ <Property Name="ITokenSecretContainingMessage.TokenSecret" Hidden="true" />
+ </Members>
<Compartments>
<Compartment Name="Methods" Collapsed="true" />
</Compartments>
<TypeIdentifier>
<HashCode>AAAAAAACAAAAAAAAAAEAAAAAAIAAIAAAIAAAAAAAAAA=</HashCode>
- <FileName>Messages\GrantRequestTokenMessage.cs</FileName>
+ <FileName>Messages\UnauthorizedTokenResponse.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
- <Class Name="DotNetOAuth.Messages.DirectUserToConsumerMessage">
- <Position X="7.5" Y="5.25" Width="3" />
+ <Class Name="DotNetOAuth.Messages.UserAuthorizationResponse">
+ <Position X="7.5" Y="4.5" Width="3" />
+ <Members>
+ <Property Name="ITokenContainingMessage.Token" Hidden="true" />
+ </Members>
<Compartments>
<Compartment Name="Methods" Collapsed="true" />
</Compartments>
+ <InheritanceLine Type="DotNetOAuth.Messages.MessageBase" FixedFromPoint="true" FixedToPoint="true">
+ <Path>
+ <Point X="10.75" Y="4.688" />
+ <Point X="10.5" Y="4.688" />
+ </Path>
+ </InheritanceLine>
<TypeIdentifier>
<HashCode>AAAAAAACAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAA=</HashCode>
- <FileName>Messages\DirectUserToConsumerMessage.cs</FileName>
+ <FileName>Messages\UserAuthorizationResponse.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
- <Class Name="DotNetOAuth.Messages.DirectUserToServiceProviderMessage">
+ <Class Name="DotNetOAuth.Messages.UserAuthorizationRequest">
<Position X="4.25" Y="3" Width="3" />
+ <Members>
+ <Property Name="ITokenContainingMessage.Token" Hidden="true" />
+ </Members>
<Compartments>
<Compartment Name="Methods" Collapsed="true" />
</Compartments>
<InheritanceLine Type="DotNetOAuth.Messages.MessageBase" FixedFromPoint="true" FixedToPoint="true">
<Path>
- <Point X="10.75" Y="4.875" />
- <Point X="7.25" Y="4.875" />
+ <Point X="10.75" Y="4.125" />
+ <Point X="7.25" Y="4.125" />
</Path>
</InheritanceLine>
<TypeIdentifier>
<HashCode>AAAAAAACAAAAAAAAAAAAAAAAAIAAAAAAIAAAAAAAQAA=</HashCode>
- <FileName>Messages\DirectUserToServiceProviderMessage.cs</FileName>
+ <FileName>Messages\UserAuthorizationRequest.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
- <Class Name="DotNetOAuth.Messages.GrantAccessTokenMessage">
- <Position X="7.5" Y="7.5" Width="3" />
+ <Class Name="DotNetOAuth.Messages.AuthorizedTokenResponse">
+ <Position X="7.5" Y="6.25" Width="3" />
+ <Members>
+ <Property Name="ITokenContainingMessage.Token" Hidden="true" />
+ <Property Name="ITokenSecretContainingMessage.TokenSecret" Hidden="true" />
+ </Members>
<Compartments>
<Compartment Name="Methods" Collapsed="true" />
</Compartments>
- <InheritanceLine Type="DotNetOAuth.Messages.MessageBase" FixedToPoint="true">
+ <InheritanceLine Type="DotNetOAuth.Messages.MessageBase" ManuallyRouted="true" FixedFromPoint="true" FixedToPoint="true">
<Path>
- <Point X="12.5" Y="7.112" />
- <Point X="12.5" Y="7.487" />
- <Point X="10.875" Y="7.487" />
- <Point X="10.875" Y="8.5" />
- <Point X="10.5" Y="8.5" />
+ <Point X="11" Y="4.805" />
+ <Point X="11" Y="7.013" />
+ <Point X="10.5" Y="7.013" />
</Path>
</InheritanceLine>
<TypeIdentifier>
<HashCode>AAAAAAACAAAAAAAAAAAAAAAAEAAAIAAAIAAAAAAAAAA=</HashCode>
- <FileName>Messages\GrantAccessTokenMessage.cs</FileName>
+ <FileName>Messages\AuthorizedTokenResponse.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="DotNetOAuth.Messages.MessageBase">
<Position X="10.75" Y="1" Width="3.5" />
+ <Members>
+ <Field Name="extraData" Hidden="true" />
+ <Property Name="IDirectedProtocolMessage.Recipient" Hidden="true" />
+ <Property Name="IOAuthDirectedMessage.HttpMethods" Hidden="true" />
+ <Property Name="IOAuthDirectedMessage.Recipient" Hidden="true" />
+ <Method Name="IProtocolMessage.EnsureValidMessage" Hidden="true" />
+ <Property Name="IProtocolMessage.ExtraData" Hidden="true" />
+ <Property Name="IProtocolMessage.ProtocolVersion" Hidden="true" />
+ <Property Name="IProtocolMessage.RequiredProtection" Hidden="true" />
+ <Property Name="IProtocolMessage.Transport" Hidden="true" />
+ <Field Name="protectionRequired" Hidden="true" />
+ <Field Name="recipient" Hidden="true" />
+ <Field Name="transport" Hidden="true" />
+ </Members>
<Compartments>
<Compartment Name="Fields" Collapsed="true" />
</Compartments>
@@ -93,24 +126,29 @@ </TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
- <Class Name="DotNetOAuth.Messages.GetAccessTokenMessage">
- <Position X="4.25" Y="6" Width="3" />
+ <Class Name="DotNetOAuth.Messages.AuthorizedTokenRequest">
+ <Position X="4.25" Y="5.5" Width="3" />
+ <Members>
+ <Property Name="ITokenContainingMessage.Token" Hidden="true" />
+ </Members>
<Compartments>
<Compartment Name="Methods" Collapsed="true" />
</Compartments>
<InheritanceLine Type="DotNetOAuth.Messages.SignedMessageBase" ManuallyRouted="true" FixedFromPoint="true" FixedToPoint="true">
<Path>
- <Point X="4" Y="6.125" />
- <Point X="4.25" Y="6.125" />
+ <Point X="4" Y="4.947" />
+ <Point X="4.123" Y="4.947" />
+ <Point X="4.123" Y="5.75" />
+ <Point X="4.25" Y="5.75" />
</Path>
</InheritanceLine>
<TypeIdentifier>
<HashCode>AAAAAAACQAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAA=</HashCode>
- <FileName>Messages\GetAccessTokenMessage.cs</FileName>
+ <FileName>Messages\AuthorizedTokenRequest.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
- <Class Name="DotNetOAuth.Messages.GetRequestTokenMessage">
+ <Class Name="DotNetOAuth.Messages.UnauthorizedTokenRequest">
<Position X="4.25" Y="1" Width="3" />
<Compartments>
<Compartment Name="Internal" Collapsed="true" />
@@ -119,17 +157,24 @@ </Compartments>
<InheritanceLine Type="DotNetOAuth.Messages.SignedMessageBase" FixedFromPoint="true">
<Path>
- <Point X="4" Y="1.938" />
- <Point X="4.25" Y="1.938" />
+ <Point X="4" Y="1.855" />
+ <Point X="4.25" Y="1.855" />
</Path>
</InheritanceLine>
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAA=</HashCode>
- <FileName>Messages\GetRequestTokenMessage.cs</FileName>
+ <FileName>Messages\UnauthorizedTokenRequest.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="DotNetOAuth.Messages.SignedMessageBase">
<Position X="0.5" Y="1.5" Width="3.5" />
+ <Members>
+ <Property Name="ITamperResistantOAuthMessage.ConsumerSecret" Hidden="true" />
+ <Property Name="ITamperResistantOAuthMessage.HttpMethod" Hidden="true" />
+ <Property Name="ITamperResistantOAuthMessage.SignatureMethod" Hidden="true" />
+ <Property Name="ITamperResistantOAuthMessage.TokenSecret" Hidden="true" />
+ <Property Name="ITamperResistantProtocolMessage.Signature" Hidden="true" />
+ </Members>
<InheritanceLine Type="DotNetOAuth.Messages.MessageBase" FixedFromPoint="true" FixedToPoint="true">
<Path>
<Point X="12.875" Y="1" />
@@ -145,14 +190,14 @@ <Lollipop Position="0.2" />
</Class>
<Interface Name="DotNetOAuth.ChannelElements.ITamperResistantOAuthMessage">
- <Position X="11.25" Y="7.75" Width="2.5" />
+ <Position X="11.25" Y="5.25" Width="2.5" />
<TypeIdentifier>
<HashCode>AIAAAAAAAAAAAAAAAIAAAgAAAAAAIAQAAAAAAAAAAAA=</HashCode>
<FileName>ChannelElements\ITamperResistantOAuthMessage.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="DotNetOAuth.Messages.ITokenSecretContainingMessage">
- <Position X="1" Y="8.5" Width="2" />
+ <Position X="1" Y="7.5" Width="2" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAA=</HashCode>
<FileName>Messages\ITokenSecretContainingMessage.cs</FileName>
@@ -160,7 +205,7 @@ </TypeIdentifier>
</Interface>
<Interface Name="DotNetOAuth.Messages.ITokenContainingMessage">
- <Position X="1" Y="7" Width="2" />
+ <Position X="1" Y="6" Width="2" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAA=</HashCode>
<FileName>Messages\ITokenContainingMessage.cs</FileName>
diff --git a/src/DotNetOAuth/Messages/GetRequestTokenMessage.cs b/src/DotNetOAuth/Messages/UnauthorizedTokenRequest.cs index f8ebc6b..cdac36f 100644 --- a/src/DotNetOAuth/Messages/GetRequestTokenMessage.cs +++ b/src/DotNetOAuth/Messages/UnauthorizedTokenRequest.cs @@ -1,5 +1,5 @@ //-----------------------------------------------------------------------
-// <copyright file="GetRequestTokenMessage.cs" company="Andrew Arnott">
+// <copyright file="UnauthorizedTokenRequest.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
@@ -11,12 +11,12 @@ namespace DotNetOAuth.Messages { /// <summary>
/// A direct message sent from Consumer to Service Provider to request a Request Token.
/// </summary>
- public class GetRequestTokenMessage : SignedMessageBase {
+ public class UnauthorizedTokenRequest : SignedMessageBase {
/// <summary>
- /// Initializes a new instance of the <see cref="GetRequestTokenMessage"/> class.
+ /// Initializes a new instance of the <see cref="UnauthorizedTokenRequest"/> class.
/// </summary>
/// <param name="serviceProvider">The URI of the Service Provider endpoint to send this message to.</param>
- protected internal GetRequestTokenMessage(MessageReceivingEndpoint serviceProvider)
+ protected internal UnauthorizedTokenRequest(MessageReceivingEndpoint serviceProvider)
: base(MessageTransport.Direct, serviceProvider) {
}
diff --git a/src/DotNetOAuth/Messages/GrantRequestTokenMessage.cs b/src/DotNetOAuth/Messages/UnauthorizedTokenResponse.cs index 7cebda0..c875ed7 100644 --- a/src/DotNetOAuth/Messages/GrantRequestTokenMessage.cs +++ b/src/DotNetOAuth/Messages/UnauthorizedTokenResponse.cs @@ -1,5 +1,5 @@ //-----------------------------------------------------------------------
-// <copyright file="GrantRequestTokenMessage.cs" company="Andrew Arnott">
+// <copyright file="UnauthorizedTokenResponse.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
@@ -12,11 +12,11 @@ namespace DotNetOAuth.Messages { /// <summary>
/// A direct message sent from Service Provider to Consumer in response to
- /// a Consumer's <see cref="GetRequestTokenMessage"/> request.
+ /// a Consumer's <see cref="UnauthorizedTokenRequest"/> request.
/// </summary>
- public class GrantRequestTokenMessage : MessageBase, ITokenSecretContainingMessage {
+ public class UnauthorizedTokenResponse : MessageBase, ITokenSecretContainingMessage {
/// <summary>
- /// Initializes a new instance of the <see cref="GrantRequestTokenMessage"/> class.
+ /// Initializes a new instance of the <see cref="UnauthorizedTokenResponse"/> class.
/// </summary>
/// <param name="requestMessage">The unauthorized request token message that this message is being generated in response to.</param>
/// <param name="requestToken">The request token.</param>
@@ -24,7 +24,7 @@ namespace DotNetOAuth.Messages { /// <remarks>
/// This constructor is used by the Service Provider to send the message.
/// </remarks>
- protected internal GrantRequestTokenMessage(GetRequestTokenMessage requestMessage, string requestToken, string tokenSecret) : this() {
+ protected internal UnauthorizedTokenResponse(UnauthorizedTokenRequest requestMessage, string requestToken, string tokenSecret) : this() {
if (requestMessage == null) {
throw new ArgumentNullException("requestMessage");
}
@@ -41,10 +41,10 @@ namespace DotNetOAuth.Messages { }
/// <summary>
- /// Initializes a new instance of the <see cref="GrantRequestTokenMessage"/> class.
+ /// Initializes a new instance of the <see cref="UnauthorizedTokenResponse"/> class.
/// </summary>
/// <remarks>This constructor is used by the consumer to deserialize the message.</remarks>
- protected internal GrantRequestTokenMessage()
+ protected internal UnauthorizedTokenResponse()
: base(MessageProtections.None, MessageTransport.Direct) {
}
@@ -81,7 +81,7 @@ namespace DotNetOAuth.Messages { /// <summary>
/// Gets the original request for an unauthorized token.
/// </summary>
- internal GetRequestTokenMessage RequestMessage { get; private set; }
+ internal UnauthorizedTokenRequest RequestMessage { get; private set; }
/// <summary>
/// Gets or sets the Token Secret.
diff --git a/src/DotNetOAuth/Messages/DirectUserToServiceProviderMessage.cs b/src/DotNetOAuth/Messages/UserAuthorizationRequest.cs index 20ad5b7..4dfa80b 100644 --- a/src/DotNetOAuth/Messages/DirectUserToServiceProviderMessage.cs +++ b/src/DotNetOAuth/Messages/UserAuthorizationRequest.cs @@ -1,5 +1,5 @@ //-----------------------------------------------------------------------
-// <copyright file="DirectUserToServiceProviderMessage.cs" company="Andrew Arnott">
+// <copyright file="UserAuthorizationRequest.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
@@ -11,24 +11,26 @@ namespace DotNetOAuth.Messages { using DotNetOAuth.Messaging;
/// <summary>
- /// A message used to redirect the user from a Consumer to a Service Provider's web site.
+ /// A message used to redirect the user from a Consumer to a Service Provider's web site
+ /// so the Service Provider can ask the user to authorize the Consumer's access to some
+ /// protected resource(s).
/// </summary>
- public class DirectUserToServiceProviderMessage : MessageBase, ITokenContainingMessage {
+ public class UserAuthorizationRequest : MessageBase, ITokenContainingMessage {
/// <summary>
- /// Initializes a new instance of the <see cref="DirectUserToServiceProviderMessage"/> class.
+ /// Initializes a new instance of the <see cref="UserAuthorizationRequest"/> class.
/// </summary>
/// <param name="serviceProvider">The URI of the Service Provider endpoint to send this message to.</param>
/// <param name="requestToken">The request token.</param>
- internal DirectUserToServiceProviderMessage(MessageReceivingEndpoint serviceProvider, string requestToken)
+ internal UserAuthorizationRequest(MessageReceivingEndpoint serviceProvider, string requestToken)
: this(serviceProvider) {
this.RequestToken = requestToken;
}
/// <summary>
- /// Initializes a new instance of the <see cref="DirectUserToServiceProviderMessage"/> class.
+ /// Initializes a new instance of the <see cref="UserAuthorizationRequest"/> class.
/// </summary>
/// <param name="serviceProvider">The URI of the Service Provider endpoint to send this message to.</param>
- internal DirectUserToServiceProviderMessage(MessageReceivingEndpoint serviceProvider)
+ internal UserAuthorizationRequest(MessageReceivingEndpoint serviceProvider)
: base(MessageProtections.None, MessageTransport.Indirect, serviceProvider) {
}
diff --git a/src/DotNetOAuth/Messages/DirectUserToConsumerMessage.cs b/src/DotNetOAuth/Messages/UserAuthorizationResponse.cs index c73eaa4..c5312e8 100644 --- a/src/DotNetOAuth/Messages/DirectUserToConsumerMessage.cs +++ b/src/DotNetOAuth/Messages/UserAuthorizationResponse.cs @@ -1,5 +1,5 @@ //-----------------------------------------------------------------------
-// <copyright file="DirectUserToConsumerMessage.cs" company="Andrew Arnott">
+// <copyright file="UserAuthorizationResponse.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
@@ -14,12 +14,12 @@ namespace DotNetOAuth.Messages { /// <remarks>
/// The class is sealed because extra parameters are determined by the callback URI provided by the Consumer.
/// </remarks>
- public sealed class DirectUserToConsumerMessage : MessageBase, ITokenContainingMessage {
+ public sealed class UserAuthorizationResponse : MessageBase, ITokenContainingMessage {
/// <summary>
- /// Initializes a new instance of the <see cref="DirectUserToConsumerMessage"/> class.
+ /// Initializes a new instance of the <see cref="UserAuthorizationResponse"/> class.
/// </summary>
/// <param name="consumer">The URI of the Consumer endpoint to send this message to.</param>
- internal DirectUserToConsumerMessage(Uri consumer)
+ internal UserAuthorizationResponse(Uri consumer)
: base(MessageProtections.None, MessageTransport.Indirect, new MessageReceivingEndpoint(consumer, HttpDeliveryMethods.GetRequest)) {
}
diff --git a/src/DotNetOAuth/ServiceProvider.cs b/src/DotNetOAuth/ServiceProvider.cs index 99bdbca..c4d8f33 100644 --- a/src/DotNetOAuth/ServiceProvider.cs +++ b/src/DotNetOAuth/ServiceProvider.cs @@ -138,7 +138,7 @@ namespace DotNetOAuth { /// <remarks>
/// Requires HttpContext.Current.
/// </remarks>
- public GetRequestTokenMessage ReadTokenRequest() {
+ public UnauthorizedTokenRequest ReadTokenRequest() {
return this.ReadTokenRequest(this.Channel.GetRequestFromContext());
}
@@ -148,7 +148,7 @@ namespace DotNetOAuth { /// <param name="request">The incoming HTTP request.</param>
/// <returns>The incoming request, or null if no OAuth message was attached.</returns>
/// <exception cref="ProtocolException">Thrown if an unexpected OAuth message is attached to the incoming request.</exception>
- public GetRequestTokenMessage ReadTokenRequest(HttpRequest request) {
+ public UnauthorizedTokenRequest ReadTokenRequest(HttpRequest request) {
return this.ReadTokenRequest(new HttpRequestInfo(request));
}
@@ -158,8 +158,8 @@ namespace DotNetOAuth { /// <param name="request">The HTTP request to read from.</param>
/// <returns>The incoming request, or null if no OAuth message was attached.</returns>
/// <exception cref="ProtocolException">Thrown if an unexpected OAuth message is attached to the incoming request.</exception>
- public GetRequestTokenMessage ReadTokenRequest(HttpRequestInfo request) {
- GetRequestTokenMessage message;
+ public UnauthorizedTokenRequest ReadTokenRequest(HttpRequestInfo request) {
+ UnauthorizedTokenRequest message;
this.Channel.TryReadFromRequest(request, out message);
return message;
}
@@ -170,14 +170,14 @@ namespace DotNetOAuth { /// </summary>
/// <param name="request">The token request message the Consumer sent that the Service Provider is now responding to.</param>
/// <returns>The response message to send using the <see cref="Channel"/>, after optionally adding extra data to it.</returns>
- public GrantRequestTokenMessage PrepareUnauthorizedTokenMessage(GetRequestTokenMessage request) {
+ public UnauthorizedTokenResponse PrepareUnauthorizedTokenMessage(UnauthorizedTokenRequest request) {
if (request == null) {
throw new ArgumentNullException("request");
}
string token = this.TokenGenerator.GenerateRequestToken(request.ConsumerKey);
string secret = this.TokenGenerator.GenerateSecret();
- GrantRequestTokenMessage response = new GrantRequestTokenMessage(request, token, secret);
+ UnauthorizedTokenResponse response = new UnauthorizedTokenResponse(request, token, secret);
return response;
}
@@ -191,7 +191,7 @@ namespace DotNetOAuth { /// <remarks>
/// Requires HttpContext.Current.
/// </remarks>
- public DirectUserToServiceProviderMessage ReadAuthorizationRequest() {
+ public UserAuthorizationRequest ReadAuthorizationRequest() {
return this.ReadAuthorizationRequest(this.Channel.GetRequestFromContext());
}
@@ -202,7 +202,7 @@ namespace DotNetOAuth { /// <param name="request">The incoming HTTP request.</param>
/// <returns>The incoming request, or null if no OAuth message was attached.</returns>
/// <exception cref="ProtocolException">Thrown if an unexpected OAuth message is attached to the incoming request.</exception>
- public DirectUserToServiceProviderMessage ReadAuthorizationRequest(HttpRequest request) {
+ public UserAuthorizationRequest ReadAuthorizationRequest(HttpRequest request) {
return this.ReadAuthorizationRequest(new HttpRequestInfo(request));
}
@@ -213,8 +213,8 @@ namespace DotNetOAuth { /// <param name="request">The HTTP request to read from.</param>
/// <returns>The incoming request, or null if no OAuth message was attached.</returns>
/// <exception cref="ProtocolException">Thrown if an unexpected OAuth message is attached to the incoming request.</exception>
- public DirectUserToServiceProviderMessage ReadAuthorizationRequest(HttpRequestInfo request) {
- DirectUserToServiceProviderMessage message;
+ public UserAuthorizationRequest ReadAuthorizationRequest(HttpRequestInfo request) {
+ UserAuthorizationRequest message;
this.Channel.TryReadFromRequest(request, out message);
return message;
}
@@ -228,13 +228,13 @@ namespace DotNetOAuth { /// The message to send to the Consumer using <see cref="Channel"/> if one is necessary.
/// Null if the Consumer did not request a callback.
/// </returns>
- public DirectUserToConsumerMessage PrepareAuthorizationResponse(DirectUserToServiceProviderMessage request) {
+ public UserAuthorizationResponse PrepareAuthorizationResponse(UserAuthorizationRequest request) {
if (request == null) {
throw new ArgumentNullException("request");
}
if (request.Callback != null) {
- var authorization = new DirectUserToConsumerMessage(request.Callback) {
+ var authorization = new UserAuthorizationResponse(request.Callback) {
RequestToken = request.RequestToken,
};
return authorization;
@@ -251,7 +251,7 @@ namespace DotNetOAuth { /// <remarks>
/// Requires HttpContext.Current.
/// </remarks>
- public GetAccessTokenMessage ReadAccessTokenRequest() {
+ public AuthorizedTokenRequest ReadAccessTokenRequest() {
return this.ReadAccessTokenRequest(this.Channel.GetRequestFromContext());
}
@@ -261,7 +261,7 @@ namespace DotNetOAuth { /// <param name="request">The incoming HTTP request.</param>
/// <returns>The incoming request, or null if no OAuth message was attached.</returns>
/// <exception cref="ProtocolException">Thrown if an unexpected OAuth message is attached to the incoming request.</exception>
- public GetAccessTokenMessage ReadAccessTokenRequest(HttpRequest request) {
+ public AuthorizedTokenRequest ReadAccessTokenRequest(HttpRequest request) {
return this.ReadAccessTokenRequest(new HttpRequestInfo(request));
}
@@ -271,8 +271,8 @@ namespace DotNetOAuth { /// <param name="request">The HTTP request to read from.</param>
/// <returns>The incoming request, or null if no OAuth message was attached.</returns>
/// <exception cref="ProtocolException">Thrown if an unexpected OAuth message is attached to the incoming request.</exception>
- public GetAccessTokenMessage ReadAccessTokenRequest(HttpRequestInfo request) {
- GetAccessTokenMessage message;
+ public AuthorizedTokenRequest ReadAccessTokenRequest(HttpRequestInfo request) {
+ AuthorizedTokenRequest message;
this.Channel.TryReadFromRequest(request, out message);
return message;
}
@@ -282,7 +282,7 @@ namespace DotNetOAuth { /// </summary>
/// <param name="request">The Consumer's message requesting an access token.</param>
/// <returns>The HTTP response to actually send to the Consumer.</returns>
- public GrantAccessTokenMessage PrepareAccessTokenMessage(GetAccessTokenMessage request) {
+ public AuthorizedTokenResponse PrepareAccessTokenMessage(AuthorizedTokenRequest request) {
if (request == null) {
throw new ArgumentNullException("request");
}
@@ -298,7 +298,7 @@ namespace DotNetOAuth { string accessToken = this.TokenGenerator.GenerateAccessToken(request.ConsumerKey);
string tokenSecret = this.TokenGenerator.GenerateSecret();
this.TokenManager.ExpireRequestTokenAndStoreNewAccessToken(request.ConsumerKey, request.RequestToken, accessToken, tokenSecret);
- var grantAccess = new GrantAccessTokenMessage {
+ var grantAccess = new AuthorizedTokenResponse {
AccessToken = accessToken,
TokenSecret = tokenSecret,
};
@@ -316,7 +316,7 @@ namespace DotNetOAuth { /// to access the resources being requested.
/// </remarks>
/// <exception cref="ProtocolException">Thrown if an unexpected message is attached to the request.</exception>
- public AccessProtectedResourceMessage ReadProtectedResourceAuthorization() {
+ public AccessProtectedResourceRequest ReadProtectedResourceAuthorization() {
return this.ReadProtectedResourceAuthorization(this.Channel.GetRequestFromContext());
}
@@ -331,7 +331,7 @@ namespace DotNetOAuth { /// to access the resources being requested.
/// </remarks>
/// <exception cref="ProtocolException">Thrown if an unexpected message is attached to the request.</exception>
- public AccessProtectedResourceMessage ReadProtectedResourceAuthorization(HttpRequest request) {
+ public AccessProtectedResourceRequest ReadProtectedResourceAuthorization(HttpRequest request) {
return this.ReadProtectedResourceAuthorization(new HttpRequestInfo(request));
}
@@ -347,7 +347,7 @@ namespace DotNetOAuth { /// to access the resources being requested.
/// </remarks>
/// <exception cref="ProtocolException">Thrown if an unexpected message is attached to the request.</exception>
- public AccessProtectedResourceMessage ReadProtectedResourceAuthorization(HttpRequestMessageProperty request, Uri requestUri) {
+ public AccessProtectedResourceRequest ReadProtectedResourceAuthorization(HttpRequestMessageProperty request, Uri requestUri) {
return this.ReadProtectedResourceAuthorization(new HttpRequestInfo(request, requestUri));
}
@@ -362,13 +362,13 @@ namespace DotNetOAuth { /// to access the resources being requested.
/// </remarks>
/// <exception cref="ProtocolException">Thrown if an unexpected message is attached to the request.</exception>
- public AccessProtectedResourceMessage ReadProtectedResourceAuthorization(HttpRequestInfo request) {
+ public AccessProtectedResourceRequest ReadProtectedResourceAuthorization(HttpRequestInfo request) {
if (request == null) {
throw new ArgumentNullException("request");
}
- AccessProtectedResourceMessage accessMessage;
- if (this.Channel.TryReadFromRequest<AccessProtectedResourceMessage>(request, out accessMessage)) {
+ AccessProtectedResourceRequest accessMessage;
+ if (this.Channel.TryReadFromRequest<AccessProtectedResourceRequest>(request, out accessMessage)) {
if (this.TokenManager.GetTokenType(accessMessage.AccessToken) != TokenType.AccessToken) {
throw new ProtocolException(
string.Format(
@@ -388,7 +388,7 @@ namespace DotNetOAuth { /// <param name="e">The <see cref="DotNetOAuth.Messaging.ChannelEventArgs"/> instance containing the event data.</param>
private void OAuthChannel_Sending(object sender, ChannelEventArgs e) {
// Hook to store the token and secret on its way down to the Consumer.
- var grantRequestTokenResponse = e.Message as GrantRequestTokenMessage;
+ var grantRequestTokenResponse = e.Message as UnauthorizedTokenResponse;
if (grantRequestTokenResponse != null) {
this.TokenManager.StoreNewRequestToken(grantRequestTokenResponse.RequestMessage, grantRequestTokenResponse);
}
diff --git a/src/DotNetOAuth/ServiceProviderDescription.cs b/src/DotNetOAuth/ServiceProviderDescription.cs index 870133c..be7db5b 100644 --- a/src/DotNetOAuth/ServiceProviderDescription.cs +++ b/src/DotNetOAuth/ServiceProviderDescription.cs @@ -34,7 +34,7 @@ namespace DotNetOAuth { /// </summary>
/// <remarks>
/// The request URL query MUST NOT contain any OAuth Protocol Parameters.
- /// This is the URL that <see cref="Messages.GetRequestTokenMessage"/> messages are directed to.
+ /// This is the URL that <see cref="Messages.UnauthorizedTokenRequest"/> messages are directed to.
/// </remarks>
/// <exception cref="ArgumentException">Thrown if this property is set to a URI with OAuth protocol parameters.</exception>
public MessageReceivingEndpoint RequestTokenEndpoint {
@@ -56,7 +56,7 @@ namespace DotNetOAuth { /// described in Section 6.2 (Obtaining User Authorization).
/// </summary>
/// <remarks>
- /// This is the URL that <see cref="Messages.DirectUserToServiceProviderMessage"/> messages are
+ /// This is the URL that <see cref="Messages.UserAuthorizationRequest"/> messages are
/// indirectly (via the user agent) sent to.
/// </remarks>
public MessageReceivingEndpoint UserAuthorizationEndpoint { get; set; }
@@ -66,7 +66,7 @@ namespace DotNetOAuth { /// for an Access Token, described in Section 6.3 (Obtaining an Access Token).
/// </summary>
/// <remarks>
- /// This is the URL that <see cref="Messages.GetAccessTokenMessage"/> messages are directed to.
+ /// This is the URL that <see cref="Messages.AuthorizedTokenRequest"/> messages are directed to.
/// </remarks>
public MessageReceivingEndpoint AccessTokenEndpoint { get; set; }
diff --git a/src/DotNetOAuth/WebConsumer.cs b/src/DotNetOAuth/WebConsumer.cs index fbcaed0..12e8973 100644 --- a/src/DotNetOAuth/WebConsumer.cs +++ b/src/DotNetOAuth/WebConsumer.cs @@ -40,7 +40,7 @@ namespace DotNetOAuth { /// <remarks>
/// Requires HttpContext.Current.
/// </remarks>
- public DirectUserToServiceProviderMessage PrepareRequestUserAuthorization() {
+ public UserAuthorizationRequest PrepareRequestUserAuthorization() {
Uri callback = MessagingUtilities.GetRequestUrlFromContext().StripQueryArgumentsWithPrefix(Protocol.Default.ParameterPrefix);
return this.PrepareRequestUserAuthorization(callback, null, null);
}
@@ -56,7 +56,7 @@ namespace DotNetOAuth { /// <param name="requestParameters">Extra parameters to add to the request token message. Optional.</param>
/// <param name="redirectParameters">Extra parameters to add to the redirect to Service Provider message. Optional.</param>
/// <returns>The pending user agent redirect based message to be sent as an HttpResponse.</returns>
- public DirectUserToServiceProviderMessage PrepareRequestUserAuthorization(Uri callback, IDictionary<string, string> requestParameters, IDictionary<string, string> redirectParameters) {
+ public UserAuthorizationRequest PrepareRequestUserAuthorization(Uri callback, IDictionary<string, string> requestParameters, IDictionary<string, string> redirectParameters) {
string token;
return this.PrepareRequestUserAuthorization(callback, requestParameters, redirectParameters, out token);
}
@@ -68,7 +68,7 @@ namespace DotNetOAuth { /// <remarks>
/// Requires HttpContext.Current.
/// </remarks>
- public GrantAccessTokenMessage ProcessUserAuthorization() {
+ public AuthorizedTokenResponse ProcessUserAuthorization() {
return this.ProcessUserAuthorization(this.Channel.GetRequestFromContext());
}
@@ -77,7 +77,7 @@ namespace DotNetOAuth { /// </summary>
/// <param name="request">The incoming HTTP request.</param>
/// <returns>The access token, or null if no incoming authorization message was recognized.</returns>
- public GrantAccessTokenMessage ProcessUserAuthorization(HttpRequest request) {
+ public AuthorizedTokenResponse ProcessUserAuthorization(HttpRequest request) {
return this.ProcessUserAuthorization(new HttpRequestInfo(request));
}
@@ -86,9 +86,9 @@ namespace DotNetOAuth { /// </summary>
/// <param name="request">The incoming HTTP request.</param>
/// <returns>The access token, or null if no incoming authorization message was recognized.</returns>
- internal GrantAccessTokenMessage ProcessUserAuthorization(HttpRequestInfo request) {
- DirectUserToConsumerMessage authorizationMessage;
- if (this.Channel.TryReadFromRequest<DirectUserToConsumerMessage>(request, out authorizationMessage)) {
+ internal AuthorizedTokenResponse ProcessUserAuthorization(HttpRequestInfo request) {
+ UserAuthorizationResponse authorizationMessage;
+ if (this.Channel.TryReadFromRequest<UserAuthorizationResponse>(request, out authorizationMessage)) {
string requestToken = authorizationMessage.RequestToken;
return this.ProcessUserAuthorization(requestToken);
} else {
|