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 /projecttemplates/RelyingPartyLogic/OAuthAuthenticationModule.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 'projecttemplates/RelyingPartyLogic/OAuthAuthenticationModule.cs')
-rw-r--r-- | projecttemplates/RelyingPartyLogic/OAuthAuthenticationModule.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/projecttemplates/RelyingPartyLogic/OAuthAuthenticationModule.cs b/projecttemplates/RelyingPartyLogic/OAuthAuthenticationModule.cs index 13e725d..148af91 100644 --- a/projecttemplates/RelyingPartyLogic/OAuthAuthenticationModule.cs +++ b/projecttemplates/RelyingPartyLogic/OAuthAuthenticationModule.cs @@ -53,10 +53,11 @@ namespace RelyingPartyLogic { var tokenAnalyzer = new SpecialAccessTokenAnalyzer(crypto, crypto); var resourceServer = new ResourceServer(tokenAnalyzer); - IPrincipal principal; - var errorMessage = resourceServer.VerifyAccess(new HttpRequestWrapper(this.application.Context.Request), out principal); - if (errorMessage == null) { + try { + IPrincipal principal = resourceServer.GetPrincipal(new HttpRequestWrapper(this.application.Context.Request)); this.application.Context.User = principal; + } catch (ProtocolFaultResponseException ex) { + ex.ErrorResponse.Send(); } } } |