summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IDataBagFormatter.cs5
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs54
2 files changed, 31 insertions, 28 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/IDataBagFormatter.cs b/src/DotNetOpenAuth.Core/Messaging/IDataBagFormatter.cs
index c208afc..9086ee9 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IDataBagFormatter.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IDataBagFormatter.cs
@@ -64,7 +64,10 @@ namespace DotNetOpenAuth.Messaging {
/// </summary>
/// <param name="containingMessage">The message that contains the <see cref="DataBag"/> serialized value. Must not be nulll.</param>
/// <param name="data">The serialized form of the <see cref="DataBag"/> to deserialize. Must not be null or empty.</param>
- /// <returns>The deserialized value. Never null.</returns>
+ /// <param name="messagePartName">Name of the message part whose value is to be deserialized. Used for exception messages.</param>
+ /// <returns>
+ /// The deserialized value. Never null.
+ /// </returns>
T IDataBagFormatter<T>.Deserialize(IProtocolMessage containingMessage, string data, string messagePartName) {
Requires.NotNull(containingMessage, "containingMessage");
Requires.NotNullOrEmpty(data, "data");
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs
index 5ee6602..f555248 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs
@@ -117,7 +117,7 @@ namespace DotNetOpenAuth.OAuth2 {
Error = Protocol.AccessTokenRequestErrorCodes.InvalidRequest,
};
}
- } catch (ProtocolException ex) {
+ } catch (ProtocolException) {
responseMessage = new AccessTokenFailedResponse() {
Error = Protocol.AccessTokenRequestErrorCodes.InvalidRequest,
};
@@ -187,6 +187,32 @@ namespace DotNetOpenAuth.OAuth2 {
}
/// <summary>
+ /// Gets the redirect URL to use for a particular authorization request.
+ /// </summary>
+ /// <param name="authorizationRequest">The authorization request.</param>
+ /// <returns>The URL to redirect to. Never <c>null</c>.</returns>
+ /// <exception cref="ProtocolException">Thrown if no callback URL could be determined.</exception>
+ protected Uri GetCallback(EndUserAuthorizationRequest authorizationRequest) {
+ Requires.NotNull(authorizationRequest, "authorizationRequest");
+ Contract.Ensures(Contract.Result<Uri>() != null);
+
+ var client = this.AuthorizationServerServices.GetClientOrThrow(authorizationRequest.ClientIdentifier);
+
+ // Prefer a request-specific callback to the pre-registered one (if any).
+ if (authorizationRequest.Callback != null) {
+ // The OAuth channel has already validated the callback parameter against
+ // the authorization server's whitelist for this client.
+ return authorizationRequest.Callback;
+ }
+
+ // Since the request didn't include a callback URL, look up the callback from
+ // the client's preregistration with this authorization server.
+ Uri defaultCallback = client.DefaultCallback;
+ ErrorUtilities.VerifyProtocol(defaultCallback != null, OAuthStrings.NoCallback);
+ return defaultCallback;
+ }
+
+ /// <summary>
/// Prepares the response to an access token request.
/// </summary>
/// <param name="request">The request for an access token.</param>
@@ -212,31 +238,5 @@ namespace DotNetOpenAuth.OAuth2 {
response.Scope.ResetContents(tokenRequest.AuthorizationDescription.Scope);
return response;
}
-
- /// <summary>
- /// Gets the redirect URL to use for a particular authorization request.
- /// </summary>
- /// <param name="authorizationRequest">The authorization request.</param>
- /// <returns>The URL to redirect to. Never <c>null</c>.</returns>
- /// <exception cref="ProtocolException">Thrown if no callback URL could be determined.</exception>
- protected Uri GetCallback(EndUserAuthorizationRequest authorizationRequest) {
- Requires.NotNull(authorizationRequest, "authorizationRequest");
- Contract.Ensures(Contract.Result<Uri>() != null);
-
- var client = this.AuthorizationServerServices.GetClientOrThrow(authorizationRequest.ClientIdentifier);
-
- // Prefer a request-specific callback to the pre-registered one (if any).
- if (authorizationRequest.Callback != null) {
- // The OAuth channel has already validated the callback parameter against
- // the authorization server's whitelist for this client.
- return authorizationRequest.Callback;
- }
-
- // Since the request didn't include a callback URL, look up the callback from
- // the client's preregistration with this authorization server.
- Uri defaultCallback = client.DefaultCallback;
- ErrorUtilities.VerifyProtocol(defaultCallback != null, OAuthStrings.NoCallback);
- return defaultCallback;
- }
}
}