Example #1
0
        public static bool ValidateSSO(string username, string password)
        {
            if (AppSettings.IS_USE_SSO)
            {
                EsbUsers.Model.ServiceResultMessage <bool> results = ClientSso.Ins?.DangNhap(username, password);

                if (results != null && !results.IsError && results.ResultValue)
                {
                    var user = UserServices.GetUser(ClientSso.Ins.CurrentSessionLoginInfo.TenDangNhap);

                    if (user != null)
                    {
                        Sessions.UserID          = user.UserID;
                        Sessions.DisplayName     = user.FullName;
                        Sessions.User            = user;
                        Sessions.IsCurrentUseSSO = true;
                        Sessions.Role            = user.Role;

                        if (CheckRole(UserRole.TruongPhongBan, UserRole.ChuyenVien))
                        {
                            Sessions.DepartmentID = user.DepartmentID;
                        }

                        return(true);
                    }

                    return(false);
                }
            }

            return(false);
        }
Example #2
0
        public static bool ValidateSSO(string username, string password)
        {
            EsbUsers.Model.ServiceResultMessage <bool> results = ClientSso.Ins.DangNhap(username, password);

            if (!results.IsError && results.ResultValue)
            {
                var user = UserServices.GetUser(ClientSso.Ins.CurrentSessionLoginInfo.TenDangNhap);

                if (user != null)
                {
                    Sessions.UserID          = user.UserID;
                    Sessions.DisplayName     = user.FullName;
                    Sessions.User            = user;
                    Sessions.Role            = user.Role;
                    Sessions.IsCurrentUseSSO = true;
                    return(true);
                }

                return(false);
            }
            return(false);
        }