I am currently upgrading my Spring Boot Web SOAP Services project from version 2.7.9 to Spring Boot 3.2.2. The XWS-Security package/classes have been removed
org.springframework.ws.soap.security.xwss.XwsSecurityInterceptor;
org.springframework.ws.soap.security.xwss.callback.SpringPlainTextPasswordValidationCallbackHandler
and we now need to use the following Spring Classes:
org.springframework.ws.soap.security.wss4j2.Wss4jSecurityInterceptor;
org.springframework.ws.soap.security.wss4j2.callback.SpringSecurityPasswordValidationCallbackHandler;
In my original application I was able to retrieve the credentials from the SOAP Header by using the Callback handler SpringPlainTextPasswordValidationCallbackHandler and I developed a custom provider class for authenticating the username/password against an external Rest Endpoint.
I have reviewed the guide at https://spring.io/blog/2022/12/02/spring-ws-samples-upgraded-for-spring-boot-3-0 and made the changes as described.
The only problem I have is that the password in this example is loaded from an external resource and then it is compared against the SOAP UserTOken header. In my application we do not store the passwords/secrets we must validate these against an external source which could be Rest endpoint or against LDAP.
I would need to obtain the Password from the WSPasswordCallBack class, I can retrieve the username using the callback but if retrieve the password via getPassword this returns null:
WSPasswordCallback cb = (WSPasswordCallback) callback;
String username = cb.getIdentifier();
String password = cb.getPassword();
Please let me know how I can retrieve the password in the SOAP Header?
Integrated SpringSecurityPasswordValidationCallbackHandler changes for Spring Boot 3.2.3, password retrieved via callback is null.
R Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.