c# - 为什么测试用户的组成员身份不会产生预期的结果?
问题描述
请检查以下代码。
WindowsIdentity identity = HttpContext.Current.Request.LogonUserIdentity;
WindowsPrincipal principal = new WindowsPrincipal(identity);
bool result = Principal.IsInRole("Active Directory Group Name");
if(result == true)
{
// Able to access the page
}
else
{
// No access to this page
}
我的组织中有一个 pin,它被添加到“Active Directory 组”中。现在,我可以访问本地主机中的页面了。我对代码进行了一些更改,并在 DEV 中部署了代码,并尝试访问 DEV 中的页面以测试应用程序。在 DEV 中,我无法访问这些页面。它应该执行if
块,而是执行else
块。
你能帮我吗:
- 安全在哪里阻止我?
- 我还需要确保什么?
解决方案
推荐阅读
- apache-spark - Spark 历史 UI 无法在 Datastax 5.1 集群上加载所有已完成和未完成的作业,Spark 版本:2.0.2.15
- r - 数据框中按字符列分组的错误 - dplyr
- ruby - 防止多个数据库调用(从内存中读取)
- c# - Exchange 服务 - EWS - 仅适用于本地主机
- apache - nodejs 应用程序的 Apache htaccess 配置失败
- django - 如何调用我的自定义 PasswordResetSerializer?(Django-DRF)
- c++ - 这个有界递归的程序是否有未定义的行为?
- javascript - HEAD 请求总是导致 TypeError: Network request failed
- javascript - Angular 8:自定义 HTML 属性在组件 html 中不起作用
- c# - 在同一个 WinForm 窗口中处理多个用户控件