コード例 #1
0
        protected void Page_Init(object sender, EventArgs e)
        {
            //HttpContext.Current.Session.Add("UserSessionInfo", new UserSessionInfo()
            //{
            //    userEmail = "*****@*****.**",
            //    userName = "******"
            //});
            //return;

            var cas = new CasAuthenticationService(SamlHelperConfiguration.Config, UserSessionHandler.Get());

            if (!cas.IsSAMLResponse(new HttpContextWrapper(this.Context)))
            {
                cas.RedirectUserToCasLogin(
                    new Guid("5B95F3B2-C265-4E1A-91AB-60FC449E96EB"),
                    new Guid("85346158-DB2E-49CE-80AC-0E868527DF2B"),
                    new Guid("37B473AE-B5A5-4839-91D5-80676A86B4B9"),
                    null);
            }
            else
            {
                var sessionInfo = cas.GetSessionFromSaml(new HttpContextWrapper(this.Context));

                if (sessionInfo != null)
                {
                    HttpContext.Current.Session.Add("UserSessionInfo", sessionInfo);
                    HttpContext.Current.Session.Timeout = 20;
                }
            }
        }
コード例 #2
0
ファイル: MainWindows.cs プロジェクト: pprasit/Project
 private void InitializeWebService()
 {
     UserSessionHandler.StartService();
     WebHosting.CreateWebService();
 }