blob: f629bf6f4ffec69cdbff65e1bd153eb7ab750b4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
namespace RelyingPartyLogic {
using System;
using System.Collections.Generic;
using System.Linq;
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); }
}
private static string UriPrefixForInfoCard {
get { return new Uri(Utilities.ApplicationRoot, "infocard/").AbsoluteUri; }
}
public static string SynthesizeClaimedIdentifierFromInfoCard(string uniqueId) {
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.");
}
}
}
}
|