gpt4 book ai didi

web-services - Web 服务 soap header 身份验证

转载 作者:行者123 更新时间:2023-12-05 01:48:55 25 4
gpt4 key购买 nike

我有一个 Web 服务,我想从 soap header 对用户进行身份验证。也就是说,我想检查 soap header 中的 token ID(随机数)并根据我数据库中的值对其进行验证,如果数字匹配,我允许请求通过,否则我不想允许执行我的 Web 方法。

有没有使用 SOAP header 的简洁方法?

谢谢,

梅里纳尔贾斯瓦尔

最佳答案

你调查过WS-Security吗? ?假设您还没有将它用于其他用途,您可以在 Username 元素等中携带您的 token 。

<?xml version="1.0"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-1">
<wsse:Username>yourusername</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">yourpassword</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<yourbodygoeshere>
</soapenv:Body>
</soapenv:Envelope>

关于web-services - Web 服务 soap header 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2998480/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com