diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2011-05-28 17:31:20 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2011-05-28 17:31:20 -0700 |
commit | dbbc823b7580d4e7d5251539a8dcace730df2e3f (patch) | |
tree | 52489fda9952d9aa7ccd59fab795e6862e24753b /projecttemplates/RelyingPartyLogic/Utilities.cs | |
parent | bb155ca75f8906bde74d8adbf36fa4f4c4bcded7 (diff) | |
parent | 5ea256fa7309ad23f4278ef9113ccde5a231bff7 (diff) | |
download | DotNetOpenAuth-dbbc823b7580d4e7d5251539a8dcace730df2e3f.zip DotNetOpenAuth-dbbc823b7580d4e7d5251539a8dcace730df2e3f.tar.gz DotNetOpenAuth-dbbc823b7580d4e7d5251539a8dcace730df2e3f.tar.bz2 |
Introduced ICryptoKeyStore, and worked it into OpenID OPs, RPs, and OAuth 2.0 roles.
Diffstat (limited to 'projecttemplates/RelyingPartyLogic/Utilities.cs')
-rw-r--r-- | projecttemplates/RelyingPartyLogic/Utilities.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/projecttemplates/RelyingPartyLogic/Utilities.cs b/projecttemplates/RelyingPartyLogic/Utilities.cs index 47212e6..1f07a9e 100644 --- a/projecttemplates/RelyingPartyLogic/Utilities.cs +++ b/projecttemplates/RelyingPartyLogic/Utilities.cs @@ -142,5 +142,18 @@ GO" }; throw new ArgumentException("DateTime must be given in UTC time but was " + value.Kind.ToString()); } } + + /// <summary> + /// Ensures that local times are converted to UTC times. Unspecified kinds are recast to UTC with no conversion. + /// </summary> + /// <param name="value">The date-time to convert.</param> + /// <returns>The date-time in UTC time.</returns> + internal static DateTime AsUtc(this DateTime value) { + if (value.Kind == DateTimeKind.Unspecified) { + return new DateTime(value.Ticks, DateTimeKind.Utc); + } + + return value.ToUniversalTime(); + } } } |