-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
- SwA profile 1.1 with Wss4jSecurityInterceptor #107
base: main
Are you sure you want to change the base?
Conversation
Wss4J2 SwA signature/encryption support.
@elfogre Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@elfogre Thank you for signing the Contributor License Agreement! |
Shouldn't this use the MimeMessage API so that it works with both SAAJ and Axiom? |
My first approach was with org.springframework.ws.mime.Attachment instead of SAAJ dependant AttachmentPart . However there is a design problem with org.springframework.ws.mime.Attachment that requires a big change. I'll try to explain:
As I need all attachment mime-headers to be correctly processed in the attachmentCallbackHandler, I can't use Axiom and I have to access javax.xml.soap.AttachmentPart in SAAJ implementation. This is the reason why this callback is only for SAAJ. If we write accesors for mime-header in Attachment interface and in saaj and axiom attachment implementations, we can easily change this CallbackHandler to use SoapMessage API. I can write that code if you think it's useful |
86e5d92
to
4c5bd74
Compare
Hello Spring-ws comunity,
I'm using spring-ws to develope an AS4 server. Everything works correct (SAAJ + Wss4j2) except when I want to sign/encrypt Soap attachments in a request. When I try it, I get an error:
Caused by: org.apache.wss4j.common.ext.WSSecurityException: Error during Signature: at org.apache.wss4j.dom.action.SignatureAction.execute(SignatureAction.java:162) at org.apache.wss4j.dom.handler.WSHandler.doSenderAction(WSHandler.java:234) at org.springframework.ws.soap.security.wss4j2.Wss4jHandler.doSenderAction(Wss4jHandler.java:63) at org.springframework.ws.soap.security.wss4j2.Wss4jSecurityInterceptor.secureMessage(Wss4jSecurityInterceptor.java:563) ... 32 common frames omitted Caused by: org.apache.wss4j.common.ext.WSSecurityException: Cannot setup signature data structure at org.apache.wss4j.dom.message.WSSecSignatureBase.addReferencesToSign(WSSecSignatureBase.java:208) at org.apache.wss4j.dom.message.WSSecSignature.addReferencesToSign(WSSecSignature.java:412) at org.apache.wss4j.dom.action.SignatureAction.execute(SignatureAction.java:147) ... 35 common frames omitted Caused by: org.apache.wss4j.common.ext.WSSecurityException: no attachment callbackhandler supplied at org.apache.wss4j.dom.message.WSSecSignatureBase.addAttachmentReferences(WSSecSignatureBase.java:228) at org.apache.wss4j.dom.message.WSSecSignatureBase.addReferencesToSign(WSSecSignatureBase.java:111) ... 37 common frames omitted
Wss4j2 needs an attachmentCallbackHandler to work, but it can't be set it via Wss4jSecurityInterceptor. I've add a new field, it's setter and I add a line in initializeRequestData method to set it in the request. After this I could sign without problems attachments in SOAP.
A SAAJ attachmentCallbackHandler implementation with its test is also included in the pull request.