diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-04-28 19:56:30 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-04-28 20:01:00 -0700 |
commit | ea4325d172d8a2bc925ed362f1c35560b8c1f13e (patch) | |
tree | a04960f4cddd7f2223df83b03e89300c5051434c /src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtMessageBase.cs | |
parent | 01d8c73f818d30b20f86630d35d230b5168215d1 (diff) | |
download | DotNetOpenAuth-origin/jwt.zip DotNetOpenAuth-origin/jwt.tar.gz DotNetOpenAuth-origin/jwt.tar.bz2 |
Work toward support JWT access tokens.origin/jwt
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtMessageBase.cs')
-rw-r--r-- | src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtMessageBase.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtMessageBase.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtMessageBase.cs new file mode 100644 index 0000000..04b9655 --- /dev/null +++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Crypto/JwtMessageBase.cs @@ -0,0 +1,26 @@ +namespace DotNetOpenAuth.OAuth2.Crypto { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using DotNetOpenAuth.Messaging; + + internal class JwtMessageBase : IMessage { + private static readonly Version version = new Version(1, 0); + + private readonly Dictionary<string, string> extraData = new Dictionary<string, string>(); + + public Version Version { + get { return version; } + } + + public IDictionary<string, string> ExtraData { + get { return this.extraData; } + } + + public virtual void EnsureValidMessage() { + // The JWT spec mandates that any unexpected data in the JWT header or claims set cause a rejection. + ErrorUtilities.VerifyProtocol(this.ExtraData.Count == 0, "Unrecognized data in JWT access token with key '{0}'. Token rejected.", this.ExtraData.First().Key); + } + } +} |