帮助IIS上的Windows身份验证用户登录 [英] Help with windows authenticated user login on IIS

查看:109
本文介绍了帮助IIS上的Windows身份验证用户登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被分配来解决另一位刚刚换过工作的开发人员留下的问题,而且我运气不好。



申请表是一个时间输入站点,允许用户使用现有的Windows凭据登录来管理他们的时间。我可以通过Postman将他们在JSON中的用户名和密码传递到登录页面并进行身份验证,但是,当通过浏览器将相同的凭据输入到表单中时,它会失败。



我在下面的登录页面后面发布了一些截图和代码。如果您还需要查看其他内容,请告诉我们。



http://delorean.cisng888.csa/



在sli.mg上托管相册 [ ^ ]



 function (){
angular.module(' Thunderdome')。controller(' LoginController' function ($ http,$ scope,$ rootScope,$ location,$ cookieStore,$ state,loggedInUser,Logout,RetrieveSystemStatus){
RetrieveSystemStatus.retrieveStatus()
.then( function (data){
if (data [ 1 ]。值== 0
{
$ rootScope.systemStatus = data [ 1 ]。
$ rootScope.systemMessage = ;
executeController()
}
else if (data [< span class =code-digit> 1
]。值== - 1
{

$ rootScope.systemMessage = data [ 0 ]。
$ scope.message = $ rootScope.systemMessage;
$ rootScope.systemStatus = data [ 1 ]。值;
}
else
{
$ rootScope.systemMessage = data [ 0 ]值。
$ scope.message = $ rootScope.systemMessage;
$ rootScope.systemStatus = data [ 1 ]。值;
executeController();
}
},
function (错误){
});

function executeController()
{
// /////////////////////////////////////// /////////////////////////////////////
// 初始信息
$ scope.message =($ rootScope.systemMessage == Welcome到时间输入。:$ rootScope.systemMessage);
$ scope.username = ;
$ scope.password = ;
$ scope.returnedData = {};
$ scope.userAlreadyLoggedIn = false ;
$ scope.showModal = false ;

if (!loggedInUser.getProfile()。init)
{
if (!loggedInUser.getProfile()。errors.length)
{
$ state.go(' home.main' );
}
else
{
$ scope.message = loggedInUser.getProfile()。errors [ 0 ]消息。
}
}
// ////////// ////////////////////////////////////////////////// ///////////////////
// 功能:登录()
// 在用户发布后,执行服务调用构建用户/员工的信息以便在整个应用程序中使用。
$ scope.login = function ()
{
var data = {
userName:$ scope.username,
password:$ scope .password,
browserString navigator .appName
}
$ http( {
方法:' post'
url:' http://10.1.150.174:8002/TimeEntry.svc/Login'
header:{' Content-Type'' 应用/ JSON;字符集= UTF-8; charset-uf8'},
数据:数据
})
.success( function (数据,状态, headers,config){
$ scope.returnedData = data;
evaluateSuccessfulRetrieval();
})
.error( function (数据,状态,标题,配置){
$ scope.message = 哎呀,有问题。;
});

}

// /////// ////////////////////////////////////////////////// //////////////////////
// 功能:evaluateSuccessfulRetrieval(data)
// 获取信息和评估可能已经返回的任何错误。
function evaluateSuccessfulRetrieval()
{

< span class =code-keyword> if
($ scope.returnedData.errors.length> 0
handleReturnedError($ scope。 returnedData.errors);
else
{
$ cookieStore.put( FunStuff,$ scope.returnedData.auth);
loggedInUser.setProfile($ scope.returnedData);
$ state.go(' home.main');
}

}

// // ////////////////////////////////////////////////// ///////////////////////////
// 功能:handleReturnedError(错误)
// 处理服务调用中返回的任何错误。
function handleReturnedError(errors)
{
if (errors [ 0 ]。code!= 2
$ scope.message = errors [ 0 ]。message;
else
handleUserAlreadyLoggedIn();
}

// /////////// ////////////////////////////////////////////////// //////////////////
// 功能:handleUserAlreadyLoggedIn()
// 显示模态并删除用户访问表单元素。
function handleUserAlreadyLoggedIn()
{
$ scope.userAlreadyLoggedIn = ;
$ scope.showModal = true ;
}

// /////////// ////////////////////////////////////////////////// //////////////////
// 函数:handleUserAlreadyLoggedIn()
// 用户登录时处理异常在其他地方,他们的会话仍处于活动状态。
$ scope.logout = function (代码)
{
$ scope .showModal = false ;

if (code == ' 2'
logOutOtherLocation();
else
$ scope.userAlreadyLoggedIn = false ;
}

// /////////// ////////////////////////////////////////////////// //////////////////
// 功能:logOutOtherLocation()
// 退出用户的其他会话并继续登录此会话。
function logOutOtherLocation()
{
var logoutdata = {
Auth
EmployeeID:$ scope.username,
LogoutType 2
}

Logout.logout(logoutdata)
.then( function (data){
$ scope。登录();
},
function (错误){
$ scope.message = 哎呀,有问题。;
$ scope.userAlreadyLoggedIn = false ;
});
}
}


});
}());





我的尝试:



检查代码并修改IIS管理器中的设置

解决方案

http,


范围,

rootScope,

I got assigned to fix a problem left by another developer who just changed jobs, and I'm not having very much luck with it.

The application is a time entry site that allows users to log in with their existing Windows credentials to manage their time. I can pass their username and password in JSON via Postman to the login page and it will authenticate, however, when the same credentials are entered into the form via browser, it fails.

I've posted some screenshots and code behind the login page below. If there's anything else you need to see, just let me know.

http://delorean.cisng888.csa/

Album hosted on sli.mg[^]

(function() {
  angular.module('Thunderdome').controller('LoginController', function($http, $scope, $rootScope, $location, $cookieStore, $state, loggedInUser, Logout, RetrieveSystemStatus) {
	RetrieveSystemStatus.retrieveStatus()
		.then(function(data){
			if(data[1].Value == "0")
			{
				$rootScope.systemStatus = data[1].Value;
				$rootScope.systemMessage = "";
				executeController()
			}
			else if(data[1].Value == "-1")
			{
			
				$rootScope.systemMessage = data[0].Value;
				$scope.message = $rootScope.systemMessage;
				$rootScope.systemStatus = data[1].Value;
			}
			else
			{
				$rootScope.systemMessage = data[0].Value;
				$scope.message = $rootScope.systemMessage;
				$rootScope.systemStatus = data[1].Value;
				executeController();
			}				
		},
		function(error){
		});
		
	function executeController()
	{
		//////////////////////////////////////////////////////////////////////////////
		//Initial Information
		$scope.message = ($rootScope.systemMessage == "" ? "Welcome to Time Entry." : $rootScope.systemMessage);
		$scope.username = "";
		$scope.password = "";
		$scope.returnedData = {};
		$scope.userAlreadyLoggedIn = false;
		$scope.showModal = false;
		
		if(!loggedInUser.getProfile().init)
		{
			if(!loggedInUser.getProfile().errors.length)
			{
				$state.go('home.main');
			}
			else
			{
				$scope.message = loggedInUser.getProfile().errors[0].message;
			}
		}
		/////////////////////////////////////////////////////////////////////////////////
		//Function: login()
		//Upon the user submisssion, perform the service call to build the user/employee's information for usage throughout the application.
		$scope.login = function()
		{
			var data = {
							"userName": $scope.username,
							"password": $scope.password,
							"browserString": navigator.appName
					}
			$http({
				  method: 'post',
				  url: 'http://10.1.150.174:8002/TimeEntry.svc/Login', 
				  headers: {'Content-Type':'application/json; charset=UTF-8; charset-uf8'},
				  data: data
				})
			.success(function(data, status, headers, config) {
				$scope.returnedData = data;
				evaluateSuccessfulRetrieval();
			})
			.error(function(data, status, headers, config) {
				$scope.message = "Oops, there has been issue.";
			});
				
		}
		
		/////////////////////////////////////////////////////////////////////////////////
		//Function: evaluateSuccessfulRetrieval(data)
		//Takes the information and evaluates for any errors that may have been returned.
		function evaluateSuccessfulRetrieval()
		{
			
			if($scope.returnedData.errors.length > 0)
				handleReturnedError($scope.returnedData.errors);
			else
			{
				$cookieStore.put("FunStuff", $scope.returnedData.auth);
				loggedInUser.setProfile($scope.returnedData);
				$state.go('home.main');
			}
			
		}
		
		/////////////////////////////////////////////////////////////////////////////////
		//Function: handleReturnedError(errors)
		//Handle any returned errors from the service call.
		function handleReturnedError(errors)
		{
			if(errors[0].code != 2)
				$scope.message = errors[0].message;
			else
				handleUserAlreadyLoggedIn();
		}
		
		/////////////////////////////////////////////////////////////////////////////////
		//Function: handleUserAlreadyLoggedIn()
		//Display the modal and remove the ability of the user to access the form elements.
		function handleUserAlreadyLoggedIn()
		{
			$scope.userAlreadyLoggedIn = true;
			$scope.showModal = true;
		}
		
		/////////////////////////////////////////////////////////////////////////////////
		//Function: handleUserAlreadyLoggedIn()
		//Handles the exception when a user is logged in elsewhere ro their session is still active.
		$scope.logout = function(code)
		{
			$scope.showModal = false;
			
			if(code == '2')
				logOutOtherLocation();
			else
				$scope.userAlreadyLoggedIn = false;
		}
		
		/////////////////////////////////////////////////////////////////////////////////
		//Function: logOutOtherLocation()
		//Log out the user's other session and proceed to log in this session.
		function logOutOtherLocation()
		{
			var logoutdata = {
							"Auth": "",
							"EmployeeID": $scope.username,
							"LogoutType": "2"
							}
			
			Logout.logout(logoutdata)
			.then(function(data){
				$scope.login();
			},
			function(error){
				$scope.message = "Oops, there has been issue.";
				$scope.userAlreadyLoggedIn = false;
			});
		}
	}
	
	
    });
}());



What I have tried:

Checked the code and tinkered with setting in IIS manager

解决方案

http,


scope,


rootScope,


这篇关于帮助IIS上的Windows身份验证用户登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆