diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-03 17:09:22 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-03 17:09:22 -0800 |
commit | 2c9f30595e5de2a2ebb80d697546c7c2a78e1030 (patch) | |
tree | 76e9bc1fd274fbc0500a2e336f4fb8b3e1a8927f /samples/OAuth2ProtectedWebApi | |
parent | 60ca0442ebf684b8414c5cb0dbf91c5b916f1188 (diff) | |
download | DotNetOpenAuth-2c9f30595e5de2a2ebb80d697546c7c2a78e1030.zip DotNetOpenAuth-2c9f30595e5de2a2ebb80d697546c7c2a78e1030.tar.gz DotNetOpenAuth-2c9f30595e5de2a2ebb80d697546c7c2a78e1030.tar.bz2 |
Fixes up user rejection cases.
Diffstat (limited to 'samples/OAuth2ProtectedWebApi')
-rw-r--r-- | samples/OAuth2ProtectedWebApi/Controllers/UserController.cs | 7 | ||||
-rw-r--r-- | samples/OAuth2ProtectedWebApi/Views/User/Authorize.cshtml | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/samples/OAuth2ProtectedWebApi/Controllers/UserController.cs b/samples/OAuth2ProtectedWebApi/Controllers/UserController.cs index 3e673c5..e627dc2 100644 --- a/samples/OAuth2ProtectedWebApi/Controllers/UserController.cs +++ b/samples/OAuth2ProtectedWebApi/Controllers/UserController.cs @@ -34,10 +34,13 @@ var authRequest = await authServer.ReadAuthorizationRequestAsync(new Uri(request)); IProtocolMessage responseMessage; if (approval) { - responseMessage = authServer.PrepareApproveAuthorizationRequest( + var grantedResponse = authServer.PrepareApproveAuthorizationRequest( authRequest, this.User.Identity.Name, authRequest.Scope); + responseMessage = grantedResponse; } else { - responseMessage = authServer.PrepareRejectAuthorizationRequest(authRequest); + var rejectionResponse = authServer.PrepareRejectAuthorizationRequest(authRequest); + rejectionResponse.Error = Protocol.EndUserAuthorizationRequestErrorCodes.AccessDenied; + responseMessage = rejectionResponse; } var response = await authServer.Channel.PrepareResponseAsync(responseMessage); diff --git a/samples/OAuth2ProtectedWebApi/Views/User/Authorize.cshtml b/samples/OAuth2ProtectedWebApi/Views/User/Authorize.cshtml index 0664741..930788e 100644 --- a/samples/OAuth2ProtectedWebApi/Views/User/Authorize.cshtml +++ b/samples/OAuth2ProtectedWebApi/Views/User/Authorize.cshtml @@ -8,6 +8,7 @@ @using (Html.BeginForm("Respond", "User", FormMethod.Post)) { @AntiForgery.GetHtml() @Html.Hidden("request", this.ViewData["request"]) + <p>Are you sure you want to allow the client to access your data, with this scope: <b>@string.Join(" ", (IEnumerable<string>)ViewData["Scope"])</b></p> <input type="submit" name="approval" value="true" /> <input type="submit" name="approval" value="false" /> }
\ No newline at end of file |