Windows身份验证没有挑战性的浏览器出来的域 [英] Windows authentication is not challenging browsers out of the domain

查看:112
本文介绍了Windows身份验证没有挑战性的浏览器出来的域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序,允许匿名访问和Windows身份验证。

I have a web application that allows anonymous access and windows authentication.

基本上,该应用程序尝试自动登录用户可以通过Windows身份验证如果Windows用户在应用程序中的用户列表,否则显示登录界面。如果没有提供凭据,应用程序然后显示一个登录界面,用户可以登录使用的应用程序内部用户。

Basically, the app try to auto-login users by windows authentication if the windows user is in a user list in the application, otherwise it shows the login screen. If no credential is provided, the app then shows a login screen where the user could login using a application internal user.

据我所知,Windows身份验证是一个具有挑战性的协议,所以我要以迫使浏览器发送凭据返回一个未经授权。

As far as I know, Windows Authentication is a challenging protocol, so I have to return an Unauthorized in order to force the browser to send the credentials.

是机器时,我域内它的伟大工程。

It works great when are machines inside my domain.

在我的域中的机器,用户在列表中:

Machine in my domain which the user is in the list:


  • 无凭据的浏览器问题的请求。

  • Web应用程序的自定义过滤器授权拒绝连接(挑战)。

  • 浏览器重新发出与Windows凭据的要求。

  • Web应用程序的身份验证的Windows用户,并允许它得到它。

在机器我的域名,用户不在允许列表:

Machine in my domain which the user is not in the allowed list:


  • 无凭据的浏览器问题的请求。

  • Web应用程序的自定义过滤器授权拒绝连接(挑战)。

  • 浏览器重新发出与Windows凭据的要求。

  • Web应用程序无法进行身份验证请求,并重定向到登录屏幕。

现在问题来了。

机出我的域名,用户不在允许列表:

Machine out of my domain which the user is not in the allowed list:


  • 无凭据的浏览器问题的请求。

  • Web应用程序的自定义过滤器授权拒绝连接(挑战)。

  • 浏览器显示一个Windows登录屏幕,并且不重新发出请求。

为什么请求没有补发当服务器返回未经授权的?

Why the request is not reissued when the server is returning unauthorized?

如果我关闭AUTH对话框,并刷新浏览器,然后应用程序重定向到登录页面。

If I close the auth dialog, and refresh the browser, then the app redirects to the login page.

问候。

推荐答案

好吧,如果计算机是服务器域之外,该浏览器将不会尝试发送凭证(因为它会在Windows身份验证方面可能毫无意义),它会提示输入第一个HTTP 401后的凭据。

Well, if the computer is outside the server domain, the browser won't try to send the credentials (as it would be probably pointless in terms of Windows authentication) and it will prompt for credentials after the first HTTP 401.

解决方案是启用匿名身份验证和Windows身份验证在一起,让登录页面进行匿名访问。在登录页面上发生的登录控件和一个按钮命名为如Windows登录的即导航到一个名为WindowsAuth的操作方法。在这种操作方法,返回 HttpUnauthorizedResult ,如果不是 Request.LogonUserIdentity.IsAuthenticated ,并且重定向到主页,否则这将迫使浏览器发送Windows凭据。

The solution is enable Anonymous authentication and Windows authentication together, and let the LogOn page be accessed anonymously. In the LogOn page place the login controls, and a button named for example "Windows Login" that navigates to an action method named "WindowsAuth". In that action method, return HttpUnauthorizedResult if not Request.LogonUserIdentity.IsAuthenticated, and redirects to Home otherwise, that will force the browser to send the Windows credentials.

如果域之外的浏览器尝试做一个Windows登录,它会得到一个不错的HTTP 401未经授权页面,这样他就可以打回,并用传统的方式进行登录。

If a browser outside of the domain tries to do a "Windows Login", it will get a nice "HTTP 401 Unauthorized" page, so he can hit back and perform login in the traditional way.

我希望这可以帮助别人。

I hope this helps somebody.

这篇关于Windows身份验证没有挑战性的浏览器出来的域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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