-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSanchuTest.java
40 lines (31 loc) · 1.75 KB
/
SanchuTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.att.eg.catalog.cms.ingest.gitignore;
import com.sun.xml.internal.messaging.saaj.soap.MessageFactoryImpl;
import org.springframework.ws.context.DefaultMessageContext;
import org.springframework.ws.context.MessageContext;
import org.springframework.ws.soap.SoapMessage;
import org.springframework.ws.soap.saaj.SaajSoapMessage;
import org.springframework.ws.soap.saaj.SaajSoapMessageFactory;
import org.springframework.ws.soap.security.WsSecuritySecurementException;
import org.springframework.ws.soap.security.wss4j2.Wss4jSecurityInterceptor;
import org.springframework.ws.soap.security.wss4j2.callback.SimplePasswordValidationCallbackHandler;
import java.io.FileOutputStream;
import java.io.IOException;
public class SanchuTest extends Wss4jSecurityInterceptor {
private SimplePasswordValidationCallbackHandler samlCallbackHandler;
public void testA(javax.xml.soap.SOAPMessage soapMessage, SimplePasswordValidationCallbackHandler samlCallbackHandler) {
this.samlCallbackHandler = samlCallbackHandler;
SaajSoapMessage request = new SaajSoapMessage(soapMessage, (new MessageFactoryImpl()));
secureMessage(request, new DefaultMessageContext(request, new SaajSoapMessageFactory(new MessageFactoryImpl())));
}
@Override
protected void secureMessage(SoapMessage soapMessage, MessageContext messageContext) throws WsSecuritySecurementException {
try {
soapMessage.writeTo(new FileOutputStream("/tmp/b.xml"));
messageContext.setProperty("derivedTokenKeyIdentifier","IssuerSerialL");
super.secureMessage(soapMessage, messageContext);
soapMessage.writeTo(new FileOutputStream("/tmp/q.xml"));
} catch (IOException e) {
e.printStackTrace();
}
}
}