ServiceSecurityContext 为何包含 WindowsIdentity 属性?
即,如果用户使用 Windows 身份验证机制进行身份验证,则 ServiceSecurityContext.PrimaryIdentity 和 ServiceSecurityContext.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
返回类型 WindowsIdentity
,ServiceSecurity.PrimaryIdentity
返回类型 IIdentity
。 WindowsIdentity
类型具有比 IIdentity
更多的属性,如果需要,可以帮助您更深入地了解访问权限、声明、 token 和已验证身份用户。
特别是 token 可以帮助您模拟用户,从而获得对特权资源的访问权限。
关于wcf - ServiceSecurityContext.WindowsIdentity 的用途?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4370347/