Exemplo n.º 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 (!SSOEncrypt.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;
 }
Exemplo n.º 2
0
 public static void RedirectToLogon()
 {
     string returnUrl = HttpContext.Current.Request.Url.ToString();
     RequestToken token = new RequestToken(
         returnUrl,
         DateTime.Now,
         NextSeed());
     string authUrl = ConfigurationManager.AppSettings[Constants.AuthUrl];
     string redirectUrl = string.Format("{0}?{1}={2}", authUrl, Constants.RequestToken, token.Encode());
     Response.Redirect(redirectUrl);
 }