use of org.apache.xml.security.stax.securityEvent.SecurityEventListener in project cxf by apache.
the class PolicyBasedWSS4JStaxInInterceptor method configureSecurityEventListeners.
@Override
protected List<SecurityEventListener> configureSecurityEventListeners(SoapMessage msg, WSSSecurityProperties securityProperties) throws WSSPolicyException {
final List<SecurityEventListener> securityEventListeners = new ArrayList<>(2);
securityEventListeners.addAll(super.configureSecurityEventListeners(msg, securityProperties));
Endpoint endoint = msg.getExchange().getEndpoint();
PolicyEnforcer policyEnforcer = createPolicyEnforcer(endoint.getEndpointInfo(), msg);
securityProperties.addInputProcessor(new PolicyInputProcessor(policyEnforcer, securityProperties));
securityEventListeners.add(policyEnforcer);
return securityEventListeners;
}
use of org.apache.xml.security.stax.securityEvent.SecurityEventListener in project cxf by apache.
the class XmlSecInInterceptor method prepareMessage.
private void prepareMessage(Message inMsg) throws Fault {
XMLStreamReader originalXmlStreamReader = inMsg.getContent(XMLStreamReader.class);
if (originalXmlStreamReader == null) {
InputStream is = inMsg.getContent(InputStream.class);
if (is != null) {
originalXmlStreamReader = StaxUtils.createXMLStreamReader(is);
}
}
try {
XMLSecurityProperties properties = new XMLSecurityProperties();
configureDecryptionKeys(inMsg, properties);
Crypto signatureCrypto = getSignatureCrypto(inMsg);
configureSignatureKeys(signatureCrypto, inMsg, properties);
SecurityEventListener securityEventListener = configureSecurityEventListener(signatureCrypto, inMsg, properties);
InboundXMLSec inboundXMLSec = XMLSec.getInboundWSSec(properties);
XMLStreamReader newXmlStreamReader = inboundXMLSec.processInMessage(originalXmlStreamReader, null, securityEventListener);
inMsg.setContent(XMLStreamReader.class, newXmlStreamReader);
} catch (XMLStreamException e) {
throwFault(e.getMessage(), e);
} catch (XMLSecurityException e) {
throwFault(e.getMessage(), e);
} catch (IOException e) {
throwFault(e.getMessage(), e);
} catch (UnsupportedCallbackException e) {
throwFault(e.getMessage(), e);
}
}
Aggregations