gpt4 book ai didi

java - 如何在 Apache Axis Web 服务 (SOAP) 中添加基本身份验证?

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:35:27 44 4
gpt4 key购买 nike

我使用 Maven 插件 (org.codehaus.mojo > axistools-maven-plugin) + WSDL 文件来生成 Soap Web 服务。

在 target/generated-source/wsdl2java/com.comp.proj 中生成的文件是:

  • Foo.java(java接口(interface))
  • FooServiceLocator.java
  • FooSoapBindingImpl.java(java 空实现)
  • FooSoapBindingSkeleton.java
  • FooSoapBindingStub.java

在我的项目中,我在同名包中创建了 FooSoapBindingImpl.java + 在此 java 实现中添加了我的自定义代码。

此 Web 服务已准备好在生产中使用。

所以,今天我在我的客户端上添加了基本身份验证(header => Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==)

如何在我的 Axis Web 服务中添加对此基本身份验证的检查?

最佳答案

Axis security section 'Authenticating the caller'”提到:

Clients can authenticate themselves with client certificates, or HTTP basic authentication.
The latter is too weak to be trustable on a non-encrypted channel, but works over HTTPS.

The MessageContext class will be configured with the username and password of the sender when SOAP messages are posted to the endpoint;*

参见 an example here .

use the appropriate getters to see these values. Note that Axis does not yet integrate with the servlet API authentication stuff.

查看 getter example in this answer .

关于java - 如何在 Apache Axis Web 服务 (SOAP) 中添加基本身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48889398/

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