Search in sources :

Example 1 with AlgorithmSuiteSecurityEvent

use of org.apache.xml.security.stax.securityEvent.AlgorithmSuiteSecurityEvent in project cxf by apache.

the class XmlSecInInterceptor method configureSecurityEventListener.

protected SecurityEventListener configureSecurityEventListener(final Crypto sigCrypto, final Message msg, XMLSecurityProperties securityProperties) {
    final List<SecurityEvent> incomingSecurityEventList = new LinkedList<>();
    SecurityEventListener securityEventListener = new SecurityEventListener() {

        @Override
        public void registerSecurityEvent(SecurityEvent securityEvent) throws XMLSecurityException {
            if (securityEvent.getSecurityEventType() == SecurityEventConstants.AlgorithmSuite) {
                if (encryptionProperties != null) {
                    checkEncryptionAlgorithms((AlgorithmSuiteSecurityEvent) securityEvent);
                }
                if (sigProps != null) {
                    checkSignatureAlgorithms((AlgorithmSuiteSecurityEvent) securityEvent);
                }
            } else if (securityEvent.getSecurityEventType() != SecurityEventConstants.EncryptedKeyToken && securityEvent instanceof TokenSecurityEvent<?>) {
                checkSignatureTrust(sigCrypto, msg, (TokenSecurityEvent<?>) securityEvent);
            }
            incomingSecurityEventList.add(securityEvent);
        }
    };
    msg.getExchange().put(SecurityEvent.class.getName() + ".in", incomingSecurityEventList);
    msg.put(SecurityEvent.class.getName() + ".in", incomingSecurityEventList);
    return securityEventListener;
}
Also used : AlgorithmSuiteSecurityEvent(org.apache.xml.security.stax.securityEvent.AlgorithmSuiteSecurityEvent) TokenSecurityEvent(org.apache.xml.security.stax.securityEvent.TokenSecurityEvent) SecurityEvent(org.apache.xml.security.stax.securityEvent.SecurityEvent) TokenSecurityEvent(org.apache.xml.security.stax.securityEvent.TokenSecurityEvent) LinkedList(java.util.LinkedList) SecurityEventListener(org.apache.xml.security.stax.securityEvent.SecurityEventListener)

Aggregations

LinkedList (java.util.LinkedList)1 AlgorithmSuiteSecurityEvent (org.apache.xml.security.stax.securityEvent.AlgorithmSuiteSecurityEvent)1 SecurityEvent (org.apache.xml.security.stax.securityEvent.SecurityEvent)1 SecurityEventListener (org.apache.xml.security.stax.securityEvent.SecurityEventListener)1 TokenSecurityEvent (org.apache.xml.security.stax.securityEvent.TokenSecurityEvent)1