diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2011-05-27 08:02:10 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2011-05-27 08:02:10 -0700 |
commit | be0feb422080002f7984e9a4e0161425df00d137 (patch) | |
tree | 44b0bb946f823182697778fa1bf02e0ce4926bcf /samples/OAuthAuthorizationServer/Code/Utilities.cs | |
parent | f922bee2328747e7890778473a2d1c943eaabeb1 (diff) | |
download | DotNetOpenAuth-be0feb422080002f7984e9a4e0161425df00d137.zip DotNetOpenAuth-be0feb422080002f7984e9a4e0161425df00d137.tar.gz DotNetOpenAuth-be0feb422080002f7984e9a4e0161425df00d137.tar.bz2 |
Allowed for cycling of symmetric cryptographic keys by replacing the effectively constant byte[] secret with a new ICryptoKeyStore throughout the OAuth 2 and OpenID stacks.
And StyleCop fixes.
Diffstat (limited to 'samples/OAuthAuthorizationServer/Code/Utilities.cs')
-rw-r--r-- | samples/OAuthAuthorizationServer/Code/Utilities.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/samples/OAuthAuthorizationServer/Code/Utilities.cs b/samples/OAuthAuthorizationServer/Code/Utilities.cs new file mode 100644 index 0000000..c9109bd --- /dev/null +++ b/samples/OAuthAuthorizationServer/Code/Utilities.cs @@ -0,0 +1,21 @@ +namespace OAuthAuthorizationServer.Code { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web; + + internal static class Utilities { + /// <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(); + } + } +}
\ No newline at end of file |