如何从收到的 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);
}