【问题标题】:WCF authentication with username and password soap request带有用户名和密码soap请求的WCF身份验证
【发布时间】:2018-11-15 06:56:00
【问题描述】:

我想使用用户名和密码对 WCF 服务上的请求进行身份验证 收到的请求soap头会是这样的, 那么我应该如何配置 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>

【问题讨论】:

    标签: wcf wcf-binding wcf-security


    【解决方案1】:

    您需要使用自定义 UsernamePasswordValidator 扩展。这篇文章应该有你需要的所有信息:How to: Use a Custom User Name and Password Validator

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-03
      • 1970-01-01
      • 2011-10-23
      相关资源
      最近更新 更多