Example #1
0
        public static bool TryParse(string tokenText, out RequestToken token)
        {
            token = null;
            if (string.IsNullOrEmpty(tokenText))
            {
                return(false);
            }
            string textToDecypt = HttpUtility.UrlDecode(tokenText);

            string[] vector = null;
            if (!SsoCipher.TryParseVector(textToDecypt, out vector))
            {
                return(false);
            }
            if (vector.Length != 3)
            {
                return(false);
            }
            string   returnUrl = vector[0];
            DateTime timeStamp = Convert.ToDateTime(vector[1]);
            string   seed      = vector[2];

            token = new RequestToken(returnUrl, timeStamp, seed);
            return(true);
        }
Example #2
0
        public static bool TryParse(string tokenText, out ResponseToken token)
        {
            token = null;
            if (string.IsNullOrEmpty(tokenText))
            {
                return(false);
            }
            string textToDecypt = HttpUtility.UrlDecode(tokenText);

            string[] vector = null;
            if (!SsoCipher.TryParseVector(textToDecypt, out vector))
            {
                return(false);
            }
            if (vector.Length != 5)
            {
                return(false);
            }
            string   userId     = vector[0];
            DateTime timeStamp  = Convert.ToDateTime(vector[1]);
            int      expire     = Convert.ToInt32(vector[2]);
            string   seed       = vector[3];
            int      resultCode = Convert.ToInt32(vector[4]);

            token = new ResponseToken(userId, timeStamp, expire, seed, resultCode);
            return(true);
        }
Example #3
0
 public static bool TryParse(string text, out SsoTicket ticket)
 {
     ticket = null;
     string[] vector;
     if (!SsoCipher.TryParseVector(text, out vector))
     {
         return(false);
     }
     if (vector.Length != 3)
     {
         return(false);
     }
     ticket                 = new SsoTicket();
     ticket._userId         = vector[0];
     ticket._timeStamp      = Convert.ToDateTime(vector[1]);
     ticket._expireDuration = Convert.ToInt32(vector[2]);
     return(true);
 }