【发布时间】:2011-12-19 01:17:55
【问题描述】:
如何从收到的 msmq 消息中获取发件人的 WindowsIdentity?
我使用 msmq 作为传输和带有授权规则提供程序的安全应用程序块来进行操作授权。我需要 WindowsPrincipal 而不是 GenericPrincipal 因为规则授予活动目录用户组而不是特定用户。 Message.SenderId 可以转换为 SecurityIdentifier 但我没有找到如何从中获取 WindowsIdentity。
void AuthorizeOperation(Message message)
{
// get sender windows principal
WindowsPrincipal principal = ... ???
// extract operation name from message body
string operation = ...
AuthorizationFactory.GetAuthorizationProvider().Authorize(principal, operation);
}
【问题讨论】:
-
请注意,SenderId 很容易在消息中被欺骗,因此依赖它是不安全的。
标签: c# security msmq windows-identity