예제 #1
0
        public static CustomIdentity GetCustomIdentity(string userName)
        {
            CustomIdentity identity = new CustomIdentity();

                identity.IsAuthenticated = true;
                identity.Name = userName;
                return identity;
        }
예제 #2
0
 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;
 }