wcf - 带有用户名和密码soap请求的WCF身份验证
问题描述
我想使用用户名和密码对 WCF 服务上的请求进行身份验证,收到的请求肥皂头将是这样的,我应该如何配置 wcf 服务来检查数据库中的用户名和密码。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:ns="http://schemas.datacontract.org/2004/07/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-2">
<wsse:Username></wsse:Username>
<wsse:Password></wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<tem:RequestForCustomsExemption>
<customsExemptionRequest>
<BILL_NUMBER>12583603</BILL_NUMBER>
</customsExemptionRequest>
</tem:RequestForCustomsExemption>
</soapenv:Body>
</soapenv:Envelope>
解决方案
您需要使用自定义 UsernamePasswordValidator 扩展。本文应该包含您需要的所有信息:如何:使用自定义用户名和密码验证器
推荐阅读
- ios - 如何检测用户何时拒绝启用位置服务超过 2 次?
- javascript - Node.js http 请求返回 body/msg 为空
- java - IOException:权限被拒绝(但我有权限)
- ruby-on-rails-5 - 有没有办法在链停止时中止销毁和更新记录?
- ios - 我如何知道用户是否已经使用 React-Native 接受/拒绝了 ios 通知?
- python - 找不到安装mysqlclient的正确方法
- javascript - 在“mouseenter”上显示 div 并在“click”上删除内部 div
- regex - 使用正则表达式 python 和“re”包拆分字符串
- svg - JS:使浏览器全选(Chrome,至少)
- amazon-web-services - AWS CLI 命令/JMESPATH 查询问题