我的前端key应用程序(MVC)使用一个承载密钥(SAML)对WCF后端服务器进行身份验证。身份验证工作良好,ClaimsIdentity对象被正确设置。但是,ClaimsIdentity的用户名不会出现在W3C IIS日志记录中。在前端,用户名是(IIS W3C)日志记录的一部分,它不会出现在WCF服务中。
前端日志记录:
2016-02-02 16:10:24 xxx.xxx邮政/移动/任务/任务/ 443 Wit.329406069 xxx.xxx 200 0 0 5 97 17504 937
后端日志记录:
2016-02-02 16:10:24 xxx.xxx POST /services/TaskService.svc-443-xxx.xxx- 200 0 1118 9239 765
后端日志记录中缺少用户名。
下面是我使用的绑定:
<ws2007FederationHttpBinding>
<binding>
<security mode="TransportWithMessageCredential">
<message issuedKeyType="BearerKey" establishSecurityContext="false">
<tokenRequestParameters>
<trust:SecondaryParameters xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
<trust:KeyType xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer</trust:KeyType>
<trust:SecondaryParameters xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
<trust:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer</trust:KeyType>
<trust:CanonicalizationAlgorithm>http://www.w3.org/2001/10/xml-exc-c14n#</trust:CanonicalizationAlgorithm>
<trust:EncryptionAlgorithm>http://www.w3.org/2001/04/xmlenc#aes256-cbc</trust:EncryptionAlgorithm>
</trust:SecondaryParameters>
</trust:SecondaryParameters>
</tokenRequestParameters>
</message>
</security>
</binding>
发布于 2016-02-03 10:19:38
IIS只能在使用Windows/basic (和其他几种)身份验证方法时记录用户名。
在您的示例中,IIS使用匿名身份验证,应用程序处理真正的检查。因此,IIS不记录任何信息,您必须使用自己的日志记录来跟踪用户。
https://stackoverflow.com/questions/35170821
复制相似问题