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

标签 java maven soap axis basic-authentication

我使用 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/

相关文章:

java - 使用 gradle 复制构建 Artifact

java - 在 IntelliJ 中找不到 TestNG

c# - 了解 WCF IsOneWay、CalbackContracts 和 Duplex - 我的假设是否正确?

PHP Comtrust SOAP api 响应代码 5000

javascript - SharePoint - 在 GetListItems SOAP 调用上执行用户查找

java - 来自标准 Java SE 应用程序的 Jetty

java - ANDROID:在单个可点击的 TextView 上交换字符串

maven - 如何更改Maven目标目录的创建方式?

java - 如何过滤掉 Hibernate 日志条目

Java抽象类构造函数和new关键字