当请求者使用WCF服务时,我能得到请求者的windows IPrincipal吗?
发布于 2009-06-14 15:42:15
使用此代码,您可以检查WCF服务中的当前安全上下文。
如果用户已通过身份验证,并且WindowsPrincipal不为空,则您使用的是Windows安全模型-您可以访问所有相关信息:
ServiceSecurityContext current = ServiceSecurityContext.Current;
if (!current.IsAnonymous && current.WindowsIdentity != null)
{
string userName = current.WindowsIdentity.Name;
}https://stackoverflow.com/questions/992997
复制相似问题