/// <summary> /// Single Sign On /// </summary> protected void SingleSignOne() { if (this.IsValidSSOServer()) { SitePrincipal newUser = null; if (PageUtility.GetAppConfig("SSO.Request.OnlyID").ToUpper() == "Y") { newUser = SitePrincipal.ValidateLogin(this._LOGIN_ID); } else { newUser = SitePrincipal.ValidateLogin(this._LOGIN_ID, this._PASSWORD); } if (newUser != null) { FormsAuthentication.RedirectFromLoginPage(this._LOGIN_ID, false); Response.Redirect("Main.aspx"); } } if (PageUtility.GetAppConfig("SSO").ToUpper() == "E") { string sURL = ConfigurationManager.AppSettings["SSO.MainPage"].ToString(); Response.Redirect(sURL); } }
protected void EachFromLoginPage() { SitePrincipal newUser = null; newUser = SitePrincipal.ValidateLogin(this._LOGIN_ID, this._PASSWORD); if (newUser != null) { FormsAuthentication.RedirectFromLoginPage(this._LOGIN_ID, false); Response.Redirect("Main.aspx"); } else { string sURL = ConfigurationManager.AppSettings["SSO.MainPage"].ToString(); Response.Redirect(sURL); } }
protected void loginbtn_Click(object sender, ImageClickEventArgs e) { string bscAuth = ConfigurationManager.AppSettings["BSC.Authentication"].ToString(); string domainName = ConfigurationManager.AppSettings["Domain.Name"].ToString(); SitePrincipal newUser = null; string en_use_yn = WebUtility.GetConfig("ENCRYPTION_USE_YN").ToUpper(); string encryption_oneway_mode = WebUtility.GetConfig("ENCRYPTION_ONEWAY_MODE").ToUpper(); string encPasswd; if (en_use_yn.Equals("Y")) { encPasswd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPasswd.Text, encryption_oneway_mode); } else { encPasswd = txtPasswd.Text; } if (bscAuth.Equals("Forms")) // 폼 인증 { newUser = SitePrincipal.ValidateLogin(txtLoginID.Text, encPasswd); } else if (bscAuth.Equals("Windows")) // 윈도우 인증 & 폼인증 { if (WindowAuthentication.ValidateLogin(txtLoginID.Text, encPasswd, domainName, Context)) { newUser = new SitePrincipal(txtLoginID.Text); } } if (newUser == null) { MicroBSC.Integration.COM.Biz.Biz_Com_Emp_Info bizEmpInfo = new MicroBSC.Integration.COM.Biz.Biz_Com_Emp_Info(); string emp_ref_id = bizEmpInfo.Get_Emp_Ref_Id(txtLoginID.Text); if (emp_ref_id.Length == 0) { //ID가 없음 this.ltrScript.Text = JSHelper.GetAlertScript("ID가 존재하지 않습니다."); txtLoginID.Focus(); } else { //비번이 틀림 this.ltrScript.Text = JSHelper.GetAlertScript("비밀번호가 틀렸습니다."); txtPasswd.Focus(); } } else { Context.User = newUser; SaveUserID(txtLoginID.Text, true); // 쿠키 저장 여부 //login.SetUserLogs(txtUserID.Text, Request.ServerVariables["REMOTE_ADDR"].ToString(), Request.ServerVariables["HTTP_USER_AGENT"].ToString(), Session.SessionID); SiteIdentity gUserInfo = (SiteIdentity)Context.User.Identity; //MicroBSC.Integration.CTL.Dac.Dac_Ctl_Common log = new MicroBSC.Integration.CTL.Dac.Dac_Ctl_Common(); //log.InsertConnectLog(Session.SessionID, gUserInfo.Emp_Ref_ID, gUserInfo.LoginID, gUserInfo.Emp_Name, Request.UserHostAddress, "BSC"); MicroBSC.Integration.CTL.Biz.Biz_Ctl_Common objCtlCommon = new MicroBSC.Integration.CTL.Biz.Biz_Ctl_Common(); objCtlCommon.AddConnectLog(Session.SessionID, gUserInfo.Emp_Ref_ID, gUserInfo.LoginID, gUserInfo.Emp_Name, Request.UserHostAddress, "BSC"); FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); Response.Redirect("Main.aspx"); //if (Request["ReturnUrl"] != null) //{ // //Response.Cookies["GSBNPortalWeb"].Expires = DateTime.Today.AddDays(-1); // //Response.Cookies["GSBNPortalWeb"].Value = null; // FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); // Response.Redirect("../index.aspx?" + "ReturnUrl=" + Request["ReturnUrl"]); //} //else //{ // FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); //} } }
protected void loginbtn_Click(object sender, ImageClickEventArgs e) { //세션ID 업데이트 Session.Abandon(); Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", "")); string bscAuth = ConfigurationManager.AppSettings["BSC.Authentication"].ToString(); string domainName = ConfigurationManager.AppSettings["Domain.Name"].ToString(); SitePrincipal newUser = null; string en_use_yn = WebUtility.GetConfig("ENCRYPTION_USE_YN").ToUpper(); string encryption_oneway_mode = WebUtility.GetConfig("ENCRYPTION_ONEWAY_MODE").ToUpper(); string encPasswd; if (en_use_yn.Equals("Y")) { encPasswd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPasswd.Text, encryption_oneway_mode); } else { encPasswd = txtPasswd.Text; } int loginResult = 0; int max_login_failcnt = DataTypeUtility.GetToInt32(WebUtility.GetConfig("MAX_LOGIN_FAILCNT", "5")); if (bscAuth.Equals("Forms")) // 폼 인증 { //newUser = SitePrincipal.ValidateLogin(txtLoginID.Text, encPasswd); loginResult = SitePrincipal.ValidateLogin(txtLoginID.Text, encPasswd, max_login_failcnt, out newUser); //로그인 시도 허용횟수 검사 } else if (bscAuth.Equals("Windows")) // 윈도우 인증 & 폼인증 { if (WindowAuthentication.ValidateLogin(txtLoginID.Text, encPasswd, domainName, Context)) { newUser = new SitePrincipal(txtLoginID.Text); } } if (newUser == null) { //MicroBSC.Integration.COM.Biz.Biz_Com_Emp_Info bizEmpInfo = new MicroBSC.Integration.COM.Biz.Biz_Com_Emp_Info(); //string emp_ref_id = bizEmpInfo.Get_Emp_Ref_Id(txtLoginID.Text); //if (emp_ref_id.Length == 0) //{ // //ID가 없음 // this.ltrScript.Text = JSHelper.GetAlertScript("ID가 존재하지 않습니다."); // txtLoginID.Focus(); //} //else //{ // //비번이 틀림 // this.ltrScript.Text = JSHelper.GetAlertScript("비밀번호가 틀렸습니다."); // txtPasswd.Focus(); //} if (loginResult == 0) { this.ltrScript.Text = JSHelper.GetAlertScript("ID 또는 비밀번호가 틀렸습니다."); txtPasswd.Focus(); } else if (loginResult == -1) { this.ltrScript.Text = JSHelper.GetAlertScript("로그인 시도 횟수가 초과되었습니다. 관리자에게 문의하세요."); txtPasswd.Focus(); } else { this.ltrScript.Text = JSHelper.GetAlertScript("관리자에게 문의하세요."); txtPasswd.Focus(); } } else { Context.User = newUser; SaveUserID(txtLoginID.Text, true); // 쿠키 저장 여부 //login.SetUserLogs(txtUserID.Text, Request.ServerVariables["REMOTE_ADDR"].ToString(), Request.ServerVariables["HTTP_USER_AGENT"].ToString(), Session.SessionID); SiteIdentity gUserInfo = (SiteIdentity)Context.User.Identity; //MicroBSC.Integration.CTL.Dac.Dac_Ctl_Common log = new MicroBSC.Integration.CTL.Dac.Dac_Ctl_Common(); //log.InsertConnectLog(Session.SessionID, gUserInfo.Emp_Ref_ID, gUserInfo.LoginID, gUserInfo.Emp_Name, Request.UserHostAddress, "BSC"); if (WebUtility.GetConfig("LOG_SIGNON", "N").Equals("Y")) { MicroBSC.Integration.CTL.Biz.Biz_Ctl_Common objCtlCommon = new MicroBSC.Integration.CTL.Biz.Biz_Ctl_Common(); objCtlCommon.AddConnectLog(Session.SessionID, gUserInfo.Emp_Ref_ID, gUserInfo.LoginID, gUserInfo.Emp_Name, Request.UserHostAddress, "BSC"); } if (WebUtility.GetConfig("SSL", "N").Equals("N")) { FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); Response.Redirect("Main.aspx"); } else { if (WebUtility.GetConfig("SSLLIVE", "N").Equals("Y")) { FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); Response.Redirect(WebUtility.GetConfig("SSL.MainPageLive", "Main.aspx")); } else { FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); Response.Redirect(WebUtility.GetConfig("SSL.MainPage", "Main.aspx")); } } //if (Request["ReturnUrl"] != null) //{ // //Response.Cookies["GSBNPortalWeb"].Expires = DateTime.Today.AddDays(-1); // //Response.Cookies["GSBNPortalWeb"].Value = null; // FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); // Response.Redirect("../index.aspx?" + "ReturnUrl=" + Request["ReturnUrl"]); //} //else //{ // FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); //} } }