我正在使用XML::Compile套件来使用使用WSSE安全性和sha1生成的摘要密码的SOAP API。不幸的是,XML::Compile::WSS::BasicAuth使用的密码摘要协议是
Sha1_base64(编码utf8 =>“$nonce$created$password”)。
其中$nonce和$password是文本值,$created是时间戳,而我使用的API使用摘要生成器
sha1_base64($nonce.$created.sha1($password)).'=‘
我想我可以通过使用钩子重写密码来解决这个问题,如
$wsdl->addHook(type=> 'wsse::PasswordString',替换=> \&replace_pwd);
由于curent CPAN文档没有明确指定钩子调用语法,所以我依赖于模块作者在http://grokbase.com/t/sc/xml-compile/1283vscwxz/need-help-with-xml-compile-translate-writer-and-attributes-with-namespace上的注释。但是,回调函数replace_pwd()从未被调用,结果是XML::Compile::WSS::BasicAuth生成的原始(错误)密码继续被发送。
我怎么才能让这个起作用?
蒂娅。
发布于 2015-10-21 19:24:47
最近我也遇到了同样的问题,最后创建了一个XML::BasicAuth::BasicAuth的实例,使用从XML复制的代码设置BasicAuth::wsse_Security::BasicAuth::BasicAuth->prepareWriting,以生成我需要的密码字符串,并将BasicAuth实例作为wsse_Security选项传递给XML::wsse_Security::Schema->call。
这是非常蹩脚的,但我发现使用这些库解决这个问题的唯一方法。
https://stackoverflow.com/questions/32324116
复制相似问题