summaryrefslogtreecommitdiffstats
path: root/samples/OpenIdProviderMvc/Code/FormsAuthenticationService.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-06-12 08:50:24 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2012-06-12 08:50:24 -0700
commit2b23b9affdc5064394a46a5a7d9d2ada4148450f (patch)
treedcff3fe7744dc893a31303bafaecbd4bca93ff63 /samples/OpenIdProviderMvc/Code/FormsAuthenticationService.cs
parent4aa2ffd3206cd342282e6bf3e0a518a6d0f65529 (diff)
downloadDotNetOpenAuth-2b23b9affdc5064394a46a5a7d9d2ada4148450f.zip
DotNetOpenAuth-2b23b9affdc5064394a46a5a7d9d2ada4148450f.tar.gz
DotNetOpenAuth-2b23b9affdc5064394a46a5a7d9d2ada4148450f.tar.bz2
Added PAPE max_auth_time handling to sample OP
The OpenIdRelyingPartyWebForms and OpenIdProviderMvc samples now interact via PAPE to sample enforcement of the PAPE max_auth_time parameter.
Diffstat (limited to 'samples/OpenIdProviderMvc/Code/FormsAuthenticationService.cs')
-rw-r--r--samples/OpenIdProviderMvc/Code/FormsAuthenticationService.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/samples/OpenIdProviderMvc/Code/FormsAuthenticationService.cs b/samples/OpenIdProviderMvc/Code/FormsAuthenticationService.cs
index 22db860..1f5ea54 100644
--- a/samples/OpenIdProviderMvc/Code/FormsAuthenticationService.cs
+++ b/samples/OpenIdProviderMvc/Code/FormsAuthenticationService.cs
@@ -10,6 +10,18 @@
get { return HttpContext.Current.User.Identity.Name; }
}
+ public DateTime? SignedInTimestampUtc {
+ get {
+ var cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
+ if (cookie != null) {
+ var ticket = FormsAuthentication.Decrypt(cookie.Value);
+ return ticket.IssueDate.ToUniversalTime();
+ } else {
+ return null;
+ }
+ }
+ }
+
public void SignIn(string userName, bool createPersistentCookie) {
FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
}