summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth2.ResourceServer
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-11-11 20:33:25 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2012-11-11 20:33:25 -0800
commit50bb0f06a023c679b2ebfb893ad8db91b2b2ce34 (patch)
treeb3da4258edf195ba52bc3f3155d59b5b3b8b2f00 /src/DotNetOpenAuth.OAuth2.ResourceServer
parent99bf04b289adee5dda23b06011f7249c00d885f4 (diff)
downloadDotNetOpenAuth-50bb0f06a023c679b2ebfb893ad8db91b2b2ce34.zip
DotNetOpenAuth-50bb0f06a023c679b2ebfb893ad8db91b2b2ce34.tar.gz
DotNetOpenAuth-50bb0f06a023c679b2ebfb893ad8db91b2b2ce34.tar.bz2
Wraps IOException with ProtocolException while decoding access tokens.
Related to #178
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2.ResourceServer')
-rw-r--r--src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs
index bd28821..3e74937 100644
--- a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs
+++ b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs
@@ -8,6 +8,7 @@ namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
+ using System.IO;
using System.Security.Cryptography;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth2.ChannelElements;
@@ -52,7 +53,12 @@ namespace DotNetOpenAuth.OAuth2 {
ErrorUtilities.VerifyProtocol(!string.IsNullOrEmpty(accessToken), ResourceServerStrings.MissingAccessToken);
var accessTokenFormatter = AccessToken.CreateFormatter(this.AuthorizationServerPublicSigningKey, this.ResourceServerPrivateEncryptionKey);
var token = new AccessToken();
- accessTokenFormatter.Deserialize(token, message, accessToken, Protocol.access_token);
+ try {
+ accessTokenFormatter.Deserialize(token, message, accessToken, Protocol.access_token);
+ } catch (IOException ex) {
+ throw new ProtocolException(ResourceServerStrings.InvalidAccessToken, ex);
+ }
+
return token;
}
}