summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/DotNetOpenAuth/OAuthWrap/ChannelElements/AccessToken.cs19
-rw-r--r--src/DotNetOpenAuth/OAuthWrap/ChannelElements/DataBag.cs6
2 files changed, 19 insertions, 6 deletions
diff --git a/src/DotNetOpenAuth/OAuthWrap/ChannelElements/AccessToken.cs b/src/DotNetOpenAuth/OAuthWrap/ChannelElements/AccessToken.cs
index 0fba167..6181b60 100644
--- a/src/DotNetOpenAuth/OAuthWrap/ChannelElements/AccessToken.cs
+++ b/src/DotNetOpenAuth/OAuthWrap/ChannelElements/AccessToken.cs
@@ -71,18 +71,25 @@ namespace DotNetOpenAuth.OAuthWrap.ChannelElements {
}
/// <summary>
- /// Populates this instance with data from a given string.
+ /// Checks the message state for conformity to the protocol specification
+ /// and throws an exception if the message is invalid.
/// </summary>
- /// <param name="value">The value to deserialize from.</param>
- /// <param name="containingMessage">The message that contained this token.</param>
- protected override void Decode(string value, IProtocolMessage containingMessage) {
- base.Decode(value, containingMessage);
+ /// <remarks>
+ /// <para>Some messages have required fields, or combinations of fields that must relate to each other
+ /// in specialized ways. After deserializing a message, this method checks the state of the
+ /// message to see if it conforms to the protocol.</para>
+ /// <para>Note that this property should <i>not</i> check signatures or perform any state checks
+ /// outside this scope of this particular message.</para>
+ /// </remarks>
+ /// <exception cref="ProtocolException">Thrown if the message is invalid.</exception>
+ protected override void EnsureValidMessage() {
+ base.EnsureValidMessage();
// Has this token expired?
if (this.Lifetime.HasValue) {
DateTime expirationDate = this.UtcCreationDate + this.Lifetime.Value;
if (expirationDate < DateTime.UtcNow) {
- throw new ExpiredMessageException(expirationDate, containingMessage);
+ throw new ExpiredMessageException(expirationDate, this.ContainingMessage);
}
}
}
diff --git a/src/DotNetOpenAuth/OAuthWrap/ChannelElements/DataBag.cs b/src/DotNetOpenAuth/OAuthWrap/ChannelElements/DataBag.cs
index d9e4ab6..6f6d5b6 100644
--- a/src/DotNetOpenAuth/OAuthWrap/ChannelElements/DataBag.cs
+++ b/src/DotNetOpenAuth/OAuthWrap/ChannelElements/DataBag.cs
@@ -161,6 +161,11 @@ namespace DotNetOpenAuth.OAuthWrap.ChannelElements {
internal DateTime UtcCreationDate { get; set; }
/// <summary>
+ /// Gets or sets the message that delivered this DataBag instance to this host.
+ /// </summary>
+ protected IProtocolMessage ContainingMessage { get; set; }
+
+ /// <summary>
/// Gets the type of this instance.
/// </summary>
/// <value>The type of the bag.</value>
@@ -221,6 +226,7 @@ namespace DotNetOpenAuth.OAuthWrap.ChannelElements {
Contract.Requires<ArgumentException>(!String.IsNullOrEmpty(value));
Contract.Requires<ArgumentNullException>(containingMessage != null, "containingMessage");
+ this.ContainingMessage = containingMessage;
byte[] encoded = Convert.FromBase64String(value);
if (this.encrypted) {