Intranet/Internet 的 Windows 身份验证
我正在为我的公司开发 ASP.net Web 应用程序。 有些用户在内部网络 (Intranet) 中使用此站点,有些用户则使用 Internet 站点。 我正在使用 Windows 身份验证模式。
我需要找到一种方法,对 Intranet 用户不提示 Windows 身份验证模式,对 Internet 用户提示 Windows 身份验证模式。
我怎样才能做到这一点?
I am developing an ASP.net web application for my company. Some users use this site in the internal network (Intranet) and some use the Internet site. I am using Windows Authentication mode.
I need to find a way to not prompt Windows Authentication mode for an Intranet user and prompt Windows Authentication mode for an Internet user.
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
根据您的描述,IIS 中的 Windows 身份验证可以解决问题。
首先是一些链接:
但请注意以下事项:
如果满足以下所有条件,则会发生单点登录 (SSO)(即无需提供用户名和密码即可访问应用程序) :
系统都会提示用户输入 Active Directory 域中帐户的凭据(用户名和密码),因此从互联网访问您的网络服务器的用户将收到一个弹出窗口,要求他们提供用户名和密码。
在任何其他情况下, 对于不使用单点登录的用户(提示用户输入用户名和密码),HTTP 身份验证模式很可能是 BASIC,这意味着任何可以拦截该连接的人都将能够看到正在交换的用户名和密码。 如果您采用此技术,请确保客户端和服务器之间的连接是加密的(HTTPS 或 VPN)。
Based on what your are describing, Windows Authentication in IIS will do the trick.
First some links:
However note the following:
Single sign-on (SSO) (i.e. accessing the application without providing a username and password) will occur if all the following are true:
Under any other circumstances the user will be prompted for credential (username and password) for an account within the Active Directory Domain. So user accessing your webserver from the internet would get a popup asking them to provide a username and password.
Be advised that for user not using single signon (user being prompted for username and password) the HTTP authentication mode will most likely be BASIC which mean that anybody that can intercept that connection will be able to see the username and password being exchanged. If you go with this technique make that the connection between client and server is encrypted (HTTPS or maybe a VPN).
确保您的 Web 服务器正在域上运行,并且所有 Intranet 用户都对 Web 服务器上包含您的网站的文件夹具有读取权限。
然后,确保您的 web.config 中有(假设您想检测哪个域用户正在访问您的站点。
最后,打开 IIS 管理器并右键单击该网站并选择“属性”。从那里单击“目录安全性” “选项卡,然后通过身份验证和访问控制单击“编辑”。取消选中“匿名访问”并确保选中“集成 Windows 身份验证”。这应该使网站按预期运行(假设您的 Intranet 客户端使用 IE)
Make sure your webserver is running on a domain and all your Intranet users have read access to the folder containing your website on the Web server.
Then, make sure you have in your web.config (assuming you want to detect which domain user is accessing your site.
Finally, open the IIS manager and right-click the website and choose "Properties". From there click the "Directory Security" tab and click "Edit" by Authentication and Access Control. Uncheck "Anonymous Access" and make sure "Integrated Windows Authentication" is checked. This should make the website behave as expected (assuming your intranet clients use IE)
据我所知,Windows 身份验证只能用于 Intranet,但您也可以包括表单身份验证来对 Internet 用户进行身份验证。 此页面包含一些信息和有关如何执行此操作的教程的链接。
As far as I know windows authentication can be used only for the intranet but you can also include forms authentication to authenticate internet users. This page has some info and a link for a tutorial on how to do this.
我可能会将该应用程序部署在两台不同的服务器上。 Windows 身份验证位于防火墙内的服务器上,可供经过 Windows 身份验证的用户访问和使用。 在公众面前,您将 Web 配置设置为使用表单身份验证,然后担心与后端的连接的安全。
但是,如果您想为此使用单个服务器,您可能需要阅读这篇 MSDN 文章:在 ASP.NET 中混合表单和 Windows 安全性
I would likely deploy the application on two different servers. windows authentication on a server inside the firewall that is accessible and avaible to windows authenticated users. on the public face, you set the web config to use forms authentication and then worry about securing the connection to the backend.
however, if you want to use a single server for this you might want to read this MSDN article : Mixing Forms and Windows Security in ASP.NET