summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-11-10 21:16:10 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2012-11-10 21:16:10 -0800
commit82df2874b6506f0d85afd0d13958af48cd5b5631 (patch)
tree7d8452a4f111447312cabd64f6c5f5e39b2af2b1 /src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs
parent990e44dfff5a20963e529ff764ee3ade018c3b07 (diff)
downloadDotNetOpenAuth-82df2874b6506f0d85afd0d13958af48cd5b5631.zip
DotNetOpenAuth-82df2874b6506f0d85afd0d13958af48cd5b5631.tar.gz
DotNetOpenAuth-82df2874b6506f0d85afd0d13958af48cd5b5631.tar.bz2
Fixes exception thrown on missing access token
The resource server was throwing an ArgumentException when an HTTP Authorization header appeared with a value of "Bearer " but no access token. We now throw a ProtocolException that can produce the appropriate error to the client. Fixes #230
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs')
-rw-r--r--src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs
index 54d86ff..bd28821 100644
--- a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs
+++ b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs
@@ -49,6 +49,7 @@ namespace DotNetOpenAuth.OAuth2 {
/// <returns>The deserialized, validated token.</returns>
/// <exception cref="ProtocolException">Thrown if the access token is expired, invalid, or from an untrusted authorization server.</exception>
public virtual AccessToken DeserializeAccessToken(IDirectedProtocolMessage message, string accessToken) {
+ 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);