Skip to content

Instantly share code, notes, and snippets.

@b1ff
Created April 23, 2014 09:38
Show Gist options
  • Save b1ff/11208798 to your computer and use it in GitHub Desktop.
Save b1ff/11208798 to your computer and use it in GitHub Desktop.
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