获取 Windows 用户的身份级别令牌?

发布于 2024-08-31 13:43:11 字数 242 浏览 1 评论 0原文

我想为给定用户创建一个 WindowsIdentity。我不需要它来模拟,只是为了组成员身份检查。我需要它在有域和无域的情况下都可以工作(没有 S4U Kerberos 委托的东西)。采用用户名的 WindowsIdentity 构造函数似乎仅适用于域场景。

有没有其他方法可以获得 WindowsIdentity 来执行访问检查?我最好的解决方法是使用 DirectoryServices.AccountManagement 查找用户然后枚举他们的组。

I want to create a WindowsIdentity for a given user. I don't need it for impersonation, just for group membership checks. I need it to work with and without a domain (none of that S4U Kerberos delegation stuff). The constructor for WindowsIdentity that takes a username only seems to work for domain scenarios.

Is there any other way I can get a WindowsIdentity to perform access checks? The best workaround I have is to use DirectoryServices.AccountManagement to find the user then enumerate their groups.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文