summaryrefslogtreecommitdiffstats
path: root/projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs
diff options
context:
space:
mode:
Diffstat (limited to 'projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs')
-rw-r--r--projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs b/projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs
index e44fd83..f629bf6 100644
--- a/projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs
+++ b/projecttemplates/RelyingPartyLogic/Model.AuthenticationToken.cs
@@ -5,6 +5,15 @@
using System.Web;
public partial class AuthenticationToken {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AuthenticationToken"/> class.
+ /// </summary>
+ public AuthenticationToken() {
+ this.CreatedOnUtc = DateTime.UtcNow;
+ this.LastUsedUtc = DateTime.UtcNow;
+ this.UsageCount = 1;
+ }
+
public bool IsInfoCard {
get { return this.ClaimedIdentifier.StartsWith(UriPrefixForInfoCard); }
}
@@ -17,5 +26,17 @@
string synthesizedClaimedId = UriPrefixForInfoCard + Uri.EscapeDataString(uniqueId);
return synthesizedClaimedId;
}
+
+ partial void OnLastUsedUtcChanging(DateTime value) {
+ if (value.Kind != DateTimeKind.Utc) {
+ throw new ArgumentException("DateTime must be given in UTC time.");
+ }
+ }
+
+ partial void OnCreatedOnUtcChanging(DateTime value) {
+ if (value.Kind != DateTimeKind.Utc) {
+ throw new ArgumentException("DateTime must be given in UTC time.");
+ }
+ }
}
}