Created
April 23, 2014 09:38
-
-
Save b1ff/11208798 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IFormsAuthWrapper | |
{ | |
FormsAuthenticationTicket Decrypt(string value); | |
string GetAuthToken(string username, bool persist); | |
} | |
public class FormsAuthWrapper : IFormsAuthWrapper | |
{ | |
private const int SessionTimeout = 300; | |
public FormsAuthenticationTicket Decrypt(string value) | |
{ | |
return FormsAuthentication.Decrypt(value); | |
} | |
public string GetAuthToken(string username, bool persist) | |
{ | |
var ticket = new FormsAuthenticationTicket(username, persist, SessionTimeout); | |
return FormsAuthentication.Encrypt(ticket); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment