gpt4 book ai didi

ruby - SAVON是否支持客户端证书认证

转载 作者:数据小太阳 更新时间:2023-10-29 06:56:36 26 4
gpt4 key购买 nike

我正在评估使用 web 服务的 savon...但是如果我可以使用 SSL 客户端证书对提供 SOAP web 服务的服务器进行身份验证,我找不到任何信息。我阅读了文档,但没有找到任何相关信息。

有谁知道SAVON是否支持客户端证书认证?

问候假

最佳答案

Savon 的最新稳定版本(目前为 2.2.0)通过全局选项支持 SSL 客户端证书。请参阅 the documentation 中的 SSL 部分.

这里是一些示例代码,假设 httpclient 与 httpi 一起使用:

savonConfig = {
:namespace => "http://...com",
:endpoint => 'https://...:557/x/b/c',
#:wsdl => 'https://...:557/x/b/c?wsdl',
:log_level => :debug,
:log => true,
:ssl_verify_mode => :none,
:ssl_cert_file => 'publicCert.pem',
:ssl_cert_key_file => 'privateKey.pem',
:ssl_cert_key_password => '1234',
:open_timeout => 600,
:read_timeout => 600
}

client = Savon.client savonConfig

soapBody = {
...
}


calcResponse = client.call(:charge, :message => soapBody)

如果您有 pfx 证书/ key 文件,直接使用它可能会遇到问题 - 因此您可能希望将它们拆分成单独的文件 - 有关信息,请参阅此页面:Extract public/private key from PKCS12 file for later use in SSH-PK-Authentification

希望对您有所帮助!
丹尼尔

关于ruby - SAVON是否支持客户端证书认证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15973285/

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