示例#1
0
        public LoginResponse?LoginWindowsAuthentication()
        {
            using (ScopeSessionFactory.OverrideSession())
            {
                if (!WindowsAuthenticationServer.LoginWindowsAuthentication(ControllerContext))
                {
                    return(null);
                }

                var token = AuthTokenServer.CreateToken(UserEntity.Current);

                return(new LoginResponse {
                    message = null, userEntity = UserEntity.Current, token = token
                });
            }
        }
示例#2
0
        public LoginResponse?LoginWindowsAuthentication(bool throwError)
        {
            string?error = WindowsAuthenticationServer.LoginWindowsAuthentication(ControllerContext);

            if (error != null)
            {
                if (throwError)
                {
                    throw new InvalidOperationException(error);
                }

                return(null);
            }

            var token = AuthTokenServer.CreateToken(UserEntity.Current);

            return(new LoginResponse {
                userEntity = UserEntity.Current, token = token, authenticationType = "windows"
            });
        }
示例#3
0
        public LoginResponse?LoginWindowsAuthentication(bool throwError)
        {
            using (ScopeSessionFactory.OverrideSession())
            {
                string?error = WindowsAuthenticationServer.LoginWindowsAuthentication(ControllerContext);
                if (error != null)
                {
                    if (throwError)
                    {
                        throw new InvalidOperationException(error);
                    }

                    return(null);
                }

                var token = AuthTokenServer.CreateToken(UserEntity.Current);

                return(new LoginResponse {
                    message = null, userEntity = UserEntity.Current, token = token
                });
            }
        }