public static CustomIdentity GetCustomIdentity(string userName) { CustomIdentity identity = new CustomIdentity(); identity.IsAuthenticated = true; identity.Name = userName; return identity; }
public static ICustomIdentity FromJson(string cookieString) { IdentityRepresentation serializedIdentity = null; JavaScriptSerializer serializer = new JavaScriptSerializer(); serializedIdentity = serializer.Deserialize<IdentityRepresentation>(cookieString); CustomIdentity identity = new CustomIdentity() { IsAuthenticated = serializedIdentity.IsAuthenticated, Name = serializedIdentity.Name, Roles = serializedIdentity.Roles .Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries) }; return identity; }