Web 应用程序使用窗口域帐户进行身份验证
- 作者: 殷娘娘
- 来源: 51数据库
- 2022-10-28
问题描述
如果您有一个将在网络内运行的 Web 应用程序,那么它支持 Windows 身份验证(活动目录?)是有意义的.
If you have a web application that will run inside a network, it makes sense for it to support windows authentication (active directory?).
使用 AD 安全模型是否有意义,或者我是否会创建自己的角色/安全模块,某些管理员必须为每个用户配置?
Would it make sense to use AD security model as well, or would I make my own roles/security module that some ***** would have to configure for each user?
我以前从未处理过 Windows 安全性,所以我很困惑我应该如何处理在 Windows 网络中运行的 Web 应用程序的安全性.
I've never dealt with windows security before, so I am very confused as to how I should be handling security for a web application that runs within a windows network.
我想我必须解决两个主要问题:
I guess there are 2 major points I have to tackle:
1. authentication 2. authorization
我有一种感觉,最佳实践会说自己处理授权,但使用 AD 身份验证对吗?
I have a feeling that best-practice would say to handle authorization myself, but use AD authentication right?
推荐答案
基本上 windows 处理一切,你从不存储用户名或密码,AD 和 IIS 为你做所有的工作
Basically windows handles everything, you never store usernames or passwords, AD and IIS do all the work for you
将此添加到您的 web.config
<system.web> ... <authentication mode="Windows"/> ... </system.web>
配置 Windows 身份验证
To configure Windows authentication
- 启动 Internet 信息服务(IIS).
- 右键单击您的应用程序的虚拟目录,以及然后单击属性.
- 点击目录安全选项卡.
- 下匿名访问和身份验证控件,单击编辑.
- 确保匿名访问复选框不是选择和集成Windows身份验证是唯一的选择复选框.
然后您可以再次使用 web.config 处理业务或授权.例如
You can then deal with the business or authorization using web.config again. for example
<authorization> <deny users="DomainNameUserName" /> <allow roles="DomainNameWindowsGroup" /> </authorization>
在此处阅读更多信息:http://msdn.microsoft.com/en-我们/图书馆/ms998358.aspx
- C#通过fleck实现wss协议的WebSocket多人Web实时聊天(附源码)
- 团队城市未满足要求:MSBuildTools12.0_x86_Path 存在
- 使用 MSBuild.exe 在发布模式下构建 C# 解决方案
- 当我发布 Web 应用程序时,AfterPublish 脚本不运行
- 构建时 T4 转换的产品仅在下一个构建中使用
- ASP.NET Core Application (.NET Framework) for Windows x64 only error in project.assets.json
- 新的 .csproj 格式 - 如何将整个目录指定为“链接文件"到子目录?
- 如何将条件编译符号(DefineConstants)传递给 msbuild
- MSBuild 支持 Visual Studio 2017 RTM 中的 T4 模板
- NuGet 包还原找不到包,没有源
