Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ASP.NET和ActiveDirectory是否存在每个请求(自定义)角色?_Asp.net_Roles_Security Roles - Fatal编程技术网

ASP.NET和ActiveDirectory是否存在每个请求(自定义)角色?

ASP.NET和ActiveDirectory是否存在每个请求(自定义)角色?,asp.net,roles,security-roles,Asp.net,Roles,Security Roles,我的愿景包括拥有从AD推送的全局定义的角色,但我也希望能够添加到Context.User.IsInRole(“AtransientRoleFortheIsDocumentOnly”)中,并让该工作 我曾考虑将角色推送到Thread.CurrentPrincipal中,并传入Context.User.Identity和一系列角色,但我担心的是如何将所有的ADRoles都从盒子中取出,我真的只想添加一些在请求生命周期内有效的临时角色 这可能吗?所有的角色管理器方法都是静态的,所以即使我做了自定义角色

我的愿景包括拥有从AD推送的全局定义的角色,但我也希望能够添加到Context.User.IsInRole(“AtransientRoleFortheIsDocumentOnly”)中,并让该工作

我曾考虑将角色推送到Thread.CurrentPrincipal中,并传入Context.User.Identity和一系列角色,但我担心的是如何将所有的ADRoles都从盒子中取出,我真的只想添加一些在请求生命周期内有效的临时角色


这可能吗?所有的角色管理器方法都是静态的,所以即使我做了自定义角色管理器,该管理器怎么知道您是文档id#1的读者。。。在文档#2上读/写时?

继承一个安全类,该类允许您重写CreatePermission,例如CodeAccessSecurityAttribute,并返回以下内容:

public override IPermission CreatePermission()
{
  return new PrincipalPermission(string.Empty, "MyCustomRole");
}

从允许您重写CreatePermission的安全类继承,例如CodeAccessSecurityAttribute,并返回以下内容:

public override IPermission CreatePermission()
{
  return new PrincipalPermission(string.Empty, "MyCustomRole");
}