コード例 #1
0
        /// <summary>
        /// 로그인 처리한다.
        /// </summary>
        /// <param name="userName">로그인Id</param>
        /// <param name="password">비밀번호</param>
        public virtual void ProcessingLogin(string userName, string password)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("==>>S 로그인 처리합니다. enterpriseName:{0}, userName:{1}, password:{2}",
                          AppSettings.EnterpriseName, userName, password);
            }

            if (AppSettings.Impersonate == false)
            {
                bool isVerified = VerifyUser(userName, password);

                if (isVerified == false)
                {
                    throw new InvalidOperationException(WebAppTool.GetGlobalResourceString(
                                                            AppSettings.ResourceMessages,
                                                            "LoginDifferentInfo", "로그인 정보가 일치하지 않습니다."));
                }
            }

            var identity = AppSettings.Impersonate ? CreateIdentityAsImpersonate(userName) : CreateIdentity(userName);

            SetIdentity(identity);
            SetAuthData(identity.LoginId);

            if (log.IsDebugEnabled)
            {
                log.Debug("==>>E 로그인 처리하였습니다. enterpriseName:{0}, userName:{1}, password:{2}",
                          AppSettings.EnterpriseName, userName, password);
            }
        }
コード例 #2
0
        /// <summary>
        /// 로그인 처리한다.
        /// </summary>
        /// <param name="userName">로그인Id</param>
        public virtual void ProcessingLogin(string userName)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug("==>>S 로그인 처리합니다. enterpriseName:{0}, userName:{1}",
                          AppSettings.EnterpriseName, userName);
            }

            var identity = AppSettings.Impersonate ? CreateIdentityAsImpersonate(userName) : CreateIdentity(userName);

            if (identity == null)
            {
                throw new InvalidOperationException(WebAppTool.GetGlobalResourceString(AppSettings.ResourceMessages,
                                                                                       "NotExistLoginInfo", "로그인 정보가 없습니다."));
            }

            SetIdentity(identity);
            SetAuthData(identity.LoginId);

            if (log.IsDebugEnabled)
            {
                log.Debug("==>>E 로그인 처리하였습니다. enterpriseName:{0}, userName:{1}",
                          AppSettings.EnterpriseName, userName);
            }
        }
コード例 #3
0
        /// <summary>
        /// 상태 메시지 출력
        /// </summary>
        protected static string GetStatusMessage(int offset, int total)
        {
            if (total > 0)
            {
                return(string.Format(WebAppTool.GetGlobalResourceString(AppSettings.ResourceMessages, "Msg_Query_Items_Item"), total, offset + 1));
            }

            return(WebAppTool.GetGlobalResourceString(AppSettings.ResourceMessages, "Msg_Query_Items_NoItem"));
        }
コード例 #4
0
        /// <summary>
        /// 로그인 처리
        /// </summary>
        /// <returns>로그인 성공여부</returns>
        protected virtual bool LoginProcess()
        {
            if (IsDebugEnabled)
            {
                log.Debug("로그인 사용자 정보:{0}", WebAppContext.Current.Identity);
            }

            if (WebAppContext.Current.Identity != null || AppSettings.Impersonate)
            {
                WebAppContext.Services.Authentication.Login();
            }
            else
            {
                WebAppContext.Services.Authentication.RedirectToLoginPage(false);

                string currentPath = Request.Path;

                //로그인 Url이 없거나 요청페이지와 로그인 페이지가 동일하다면
                if ((string.IsNullOrEmpty(WebAppContext.Services.Authentication.LoginUrl)) || (WebAppContext.Services.Authentication.LoginUrl.IndexOf(currentPath) == 0))
                {
                    var msgt = WebAppTool.GetGlobalResourceString(AppSettings.ResourceGlossary, "LoginFailed", "로그인 실패");
                    var msg  = WebAppTool.GetGlobalResourceString(AppSettings.ResourceMessages, "NotExistLoginInfo", "로그인 정보가 없습니다");

                    WebAppTool.MessageBox(MessageBoxDisplayKind.Page,
                                          msgt,
                                          msg,
                                          MessageType.Warning,
                                          MessageButtons.Ok | MessageButtons.Login,
                                          endResponse: false);
                }
                else
                {
                    WebAppContext.Services.Authentication.RedirectToLoginPage(false);
                }
            }

            var isLoggined = WebAppContext.Current.Identity != null;

            if (IsDebugEnabled)
            {
                log.Debug("로그인 사용자 정보:{0}, 로그인 성공여부=[{1}]", WebAppContext.Current.Identity, isLoggined);
            }

            return(isLoggined);
        }