EIAC.SSO接入接口文檔

protected void Page_Load(object sender, EventArgs e)
{
//Session.Abandon()就是把當前Session對象刪除了,下一次就是新的Session了。
Session.Abandon();
// 在此處放置用戶代碼以初始化頁麵,在頁麵第一次訪問時定位到EAC去認證
if (!IsPostBack)
{
if (Request["IASID"]== null)
{
if (AppSSOBLL.TOEACAuthenticat(InterfaceUtility.GetIASID(), AppSSOBLL.GetTimeStamp(), Request.Url.AbsoluteUri,""))
{
//todo
}
}
//接受EAC發送回來的認證信息,如果通過定位到保護頁麵
if (Request["IASID"] != null)
{
if (Request["Result"].ToString() == "0")
{
if (AppSSOBLL.ValidateFromEAC(Request["IASID"].ToString(), Request["TimeStamp"].ToString(),Request["UserAccount"].ToString(), Request["Result"].ToString(), Request["ErrorDescription"].ToString(),Request["Authenticator"].ToString()))
{
//為提供的用戶名創建一個身份驗證票證,並將其添加到響應的 Cookie 集合或 URL。
FormsAuthentication.SetAuthCookie(Request["UserAccount"], false);
FormsAuthentication.RedirectFromLoginPage(Request["UserAccount"], false);
}
}
}
}
}
小注:FormsAuthentication.RedirectFromLoginPage.這個方法接收的參數是用戶名或者其它的一些身份信息.在Asp.net中登錄用戶的狀態是持久化存儲在客戶端的cookie中.當你調用RedirectFromLoginPage時就會創建一個包含加密令牌FormsAuthenticationTicket的cookie,cookie名就是登錄用戶的用戶名
最後更新:2017-04-03 12:54:24