blob: 1f5ea541eaf57c5bb992c2caec111b736d009132 (
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
|
namespace OpenIdProviderMvc.Code {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
public class FormsAuthenticationService : IFormsAuthentication {
public string SignedInUsername {
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);
}
public void SignOut() {
FormsAuthentication.SignOut();
}
}
}
|