/// <summary> /// Gets the system identification key from FormsAuthenticationTicket /// </summary> /// <param name="ticket"></param> /// <returns></returns> public static List <string> Roles(this FormsAuthenticationTicket ticket) { NameValueCollection userData = ticket.GetUserData(); List <string> roles = CommonHelper.SplitString(userData[ROLES]); return(roles); }
/// <summary> /// Determines if the role is contained with the ticket /// </summary> /// <param name="ticket"></param> /// <param name="role"></param> /// <returns></returns> private static bool IsInRole(this FormsAuthenticationTicket ticket, string role) { NameValueCollection userData = ticket.GetUserData(); var ticketRoles = CommonHelper.SplitString(userData[ROLES]); return(ticketRoles.Contains(role)); }
/// <summary> /// Gets the Facebook access token from FormsAuthenticationTicket /// </summary> /// <param name="ticket"></param> /// <returns></returns> public static string AccessToken(this FormsAuthenticationTicket ticket) { return(ticket.GetUserData()[ACCESS_TOKEN]); }
/// <summary> /// Gets the system identification key from FormsAuthenticationTicket /// </summary> /// <param name="ticket"></param> /// <returns></returns> public static Guid IdKey(this FormsAuthenticationTicket ticket) { return(new Guid(ticket.GetUserData()[ID_KEY])); }