diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-04-21 20:11:34 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-04-21 20:11:34 -0700 |
commit | 1b6d8c2a40a019b43b252102353170380872da45 (patch) | |
tree | fb6440ce98e45fe96eee5fb8d41c67187b70d577 /samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs | |
parent | 08827a078f370a0e976102e792a16095dd501b8c (diff) | |
download | DotNetOpenAuth-1b6d8c2a40a019b43b252102353170380872da45.zip DotNetOpenAuth-1b6d8c2a40a019b43b252102353170380872da45.tar.gz DotNetOpenAuth-1b6d8c2a40a019b43b252102353170380872da45.tar.bz2 |
Replaces ResourceServer.VerifyAccess with a better pattern for error handling.
Fixes #122
Diffstat (limited to 'samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs')
-rw-r--r-- | samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs b/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs index 8d0c13d..353e838 100644 --- a/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs +++ b/samples/OAuthResourceServer/Code/OAuthAuthorizationManager.cs @@ -54,6 +54,11 @@ } else { return false; } + } catch (ProtocolFaultResponseException ex) { + Global.Logger.Error("Error processing OAuth messages.", ex); + + // Return the appropriate unauthorized response to the client. + ex.ErrorResponse.Send(); } catch (ProtocolException ex) { Global.Logger.Error("Error processing OAuth messages.", ex); } @@ -67,12 +72,7 @@ using (var signing = Global.CreateAuthorizationServerSigningServiceProvider()) { using (var encrypting = Global.CreateResourceServerEncryptionServiceProvider()) { var resourceServer = new ResourceServer(new StandardAccessTokenAnalyzer(signing, encrypting)); - - IPrincipal result; - var error = resourceServer.VerifyAccess(HttpRequestInfo.Create(httpDetails, requestUri), out result); - - // TODO: return the prepared error code. - return error != null ? null : result; + return resourceServer.GetPrincipal(httpDetails, requestUri); } } } |