public static bool Authenticate(out ResponseToken token) { string tokenText = Request[Constants.ResponseToken]; if (!ResponseToken.TryParse(tokenText, out token)) return false; if (token.Seed != _seed) return false; SSOTicket ticket = new SSOTicket(); ticket.UserId = token.UserId; ticket.TimeStamp = token.TimeStamp; ticket.ExpireDuration = token.ExpireDuration; ResetCookie(Constants.TokenCookieName, ticket.Encode()); return true; }
public static bool TryParse(string text, out SSOTicket ticket) { ticket = null; string[] vector; if (!SSOEncrypt.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; }