简体   繁体   English

枚举ASP.Net 5 / core中用户的AD安全组成员身份?

[英]Enumerating AD Security Group memberships for a User in ASP.Net 5/core?

So I see lots of information on how to do this under older ASP.Net versions, but I cannot find any information regarding how to get a list/enumeration of a User's security group memberships under ASP.Net 5/core (as an aside - which one is the official name now?). 因此,我看到了很多有关在较旧的ASP.Net版本下如何执行此操作的信息,但是我找不到有关如何在ASP.Net 5 / core下获得用户安全组成员身份的列表/枚举的任何信息(顺便说一句-现在是哪个正式名称?)。

I would even appreciate any information on how to just check for membership of a single AD group - I've tried both User.IsInRole(@"mySGDomain\\mySGName) , which always returns false, as well as the Authorize annotation: [Authorize(Roles = @"mySGDomain\\mySGName")] , which also fails. I've also gone in debug mode to try and inspect the list of Claims that I can see under the User.Identities enumeration, and none of them look like anything related to AD group memberships. 我什至希望了解有关如何仅检查单个AD组成员身份的任何信息-我已经尝试了User.IsInRole(@"mySGDomain\\mySGName) (总是返回false)以及Authorize批注: [Authorize(Roles = @"mySGDomain\\mySGName")] ,它也失败。我也进入了调试模式,尝试检查在User.Identities枚举下可以看到的Claims列表,它们看起来都不相关。到AD组成员身份。

Am I missing anything obvious here? 我在这里错过任何明显的东西吗? Is there any documentation on how to do this properly? 是否有任何有关如何正确执行此操作的文档?

IsInRole is broken in Rc1 but will be fixed in Rc2. IsInRole在Rc1中已损坏,但将在Rc2中被修复。 Unfortunately the directory services pieces have not made it into core nor will they be there by RTM (no I don't have a date!) 不幸的是,目录服务还没有成为核心,RTM也不会将它们加入其中(我没有日期!)

If all you need is IsInRole rc2 is your answer. 如果您需要的只是IsInRole rc2,则您的答案。 You could test the nightly builds to make sure. 您可以测试每晚的构建以确保。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM