wcf - ServiceSecurityContext.WindowsIdentity 的用途?

标签 wcf wcf-security

ServiceSecurityContext 为何包含 WindowsIdentity 属性?

即,如果用户使用 Windows 身份验证机制进行身份验证,则 ServiceSecurityContext.PrimaryIdentityServiceSecurityContext.WindowsIdentity 属性包含完全相同的信息,如果用户使用身份验证某些其他身份验证机制,然后 ServiceSecurityContext.WindowsIdentity 将持有空白身份。

因此,在第一种情况下,WindowsIdentity 属性持有与 PrimaryIdentity 相同的数据,而在第二种情况下,它根本不持有任何数据(即它持有空白身份)。

谢谢

最佳答案

Namely, if user is authenticated using windows authentication mechanism, then both ServiceSecurityContext.PrimaryIdentity and ServiceSecurityContext.WindowsIdentity properties hold exactly the same information

完全错了。

ServiceSecurityContext.WindowsIdentity 返回类型 WindowsIdentityServiceSecurity.PrimaryIdentity 返回类型 IIdentityWindowsIdentity 类型具有比 IIdentity 更多的属性,如果需要,可以帮助您更深入地了解访问权限、声明、 token 和已验证身份用户。

特别是 token 可以帮助您模拟用户,从而获得对特权资源的访问权限。

请参阅https://msdn.microsoft.com/en-us/library/system.security.principal.windowsidentity%28v=vs.110%29.aspx了解详情。

关于wcf - ServiceSecurityContext.WindowsIdentity 的用途?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4370347/

相关文章:

wpf - 首次使用 WPF 中的 WCF 非常慢

c# - xop+xml 和 soap+xml 之间的 WCF 类型不匹配

wcf - 在WCF服务中HttpContext.Current是否不应该为null?

wcf - 使用 WCF 连接到使用用户名/密码进行 Web 服务身份验证

.net - 是什么导致 WCF 服务/服务器期望 'Negotiate,NTLM' ?

c# - 如何在 WCF 中接受 BinarySecurityToken?

c# - "Add Service Reference"到底做了什么?

c# - WCF:使用没有 SSL 证书的自定义 UserNamePasswordValidationMode

c# - 序列化任何自定义 WCF SecurityToken 的好方法?

c# - 无法调用服务,WCF 测试客户端?