Java Code Examples for org.apache.cxf.message.MessageUtils#isOutbound()

The following examples show how to use org.apache.cxf.message.MessageUtils#isOutbound() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SamlTokenInterceptor.java    From steady with Apache License 2.0 6 votes vote down vote up
public void handleMessage(SoapMessage message) throws Fault {

        boolean isReq = MessageUtils.isRequestor(message);
        boolean isOut = MessageUtils.isOutbound(message);
        
        if (isReq != isOut) {
            //outbound on server side and inbound on client side doesn't need
            //any saml token stuff, assert policies and return
            assertSamlTokens(message);
            return;
        }
        if (isReq) {
            if (message.containsKey(PolicyBasedWSS4JOutInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            addSamlToken(message);
        } else {
            if (message.containsKey(WSS4JInInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            processSamlToken(message);
        }
    }
 
Example 2
Source File: UsernameTokenInterceptor.java    From steady with Apache License 2.0 6 votes vote down vote up
public void handleMessage(SoapMessage message) throws Fault {

        boolean isReq = MessageUtils.isRequestor(message);
        boolean isOut = MessageUtils.isOutbound(message);
        if (isReq != isOut) {
            //outbound on server side and inbound on client side doesn't need
            //any username token stuff, assert policies and return
            assertUsernameTokens(message, null);
            return;
        }
        if (isReq) {
            if (message.containsKey(PolicyBasedWSS4JOutInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            addUsernameToken(message);
        } else {
            if (message.containsKey(WSS4JInInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            processUsernameToken(message);
        }
    }
 
Example 3
Source File: SamlTokenInterceptor.java    From steady with Apache License 2.0 6 votes vote down vote up
public void handleMessage(SoapMessage message) throws Fault {

        boolean isReq = MessageUtils.isRequestor(message);
        boolean isOut = MessageUtils.isOutbound(message);
        
        if (isReq != isOut) {
            //outbound on server side and inbound on client side doesn't need
            //any saml token stuff, assert policies and return
            assertSamlTokens(message);
            return;
        }
        if (isReq) {
            if (message.containsKey(PolicyBasedWSS4JOutInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            addSamlToken(message);
        } else {
            if (message.containsKey(WSS4JInInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            processSamlToken(message);
        }
    }
 
Example 4
Source File: UsernameTokenInterceptor.java    From steady with Apache License 2.0 6 votes vote down vote up
public void handleMessage(SoapMessage message) throws Fault {

        boolean isReq = MessageUtils.isRequestor(message);
        boolean isOut = MessageUtils.isOutbound(message);
        if (isReq != isOut) {
            //outbound on server side and inbound on client side doesn't need
            //any username token stuff, assert policies and return
            assertUsernameTokens(message, null);
            return;
        }
        if (isReq) {
            if (message.containsKey(PolicyBasedWSS4JOutInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            addUsernameToken(message);
        } else {
            if (message.containsKey(WSS4JInInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            processUsernameToken(message);
        }
    }
 
Example 5
Source File: SamlTokenInterceptor.java    From steady with Apache License 2.0 6 votes vote down vote up
public void handleMessage(SoapMessage message) throws Fault {

        boolean isReq = MessageUtils.isRequestor(message);
        boolean isOut = MessageUtils.isOutbound(message);
        
        if (isReq != isOut) {
            //outbound on server side and inbound on client side doesn't need
            //any saml token stuff, assert policies and return
            assertSamlTokens(message);
            return;
        }
        if (isReq) {
            if (message.containsKey(PolicyBasedWSS4JOutInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            addSamlToken(message);
        } else {
            if (message.containsKey(WSS4JInInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            processSamlToken(message);
        }
    }
 
Example 6
Source File: UsernameTokenInterceptor.java    From steady with Apache License 2.0 6 votes vote down vote up
public void handleMessage(SoapMessage message) throws Fault {

        boolean isReq = MessageUtils.isRequestor(message);
        boolean isOut = MessageUtils.isOutbound(message);
        if (isReq != isOut) {
            //outbound on server side and inbound on client side doesn't need
            //any username token stuff, assert policies and return
            assertUsernameTokens(message, null);
            return;
        }
        if (isReq) {
            if (message.containsKey(PolicyBasedWSS4JOutInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            addUsernameToken(message);
        } else {
            if (message.containsKey(WSS4JInInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            processUsernameToken(message);
        }
    }
 
Example 7
Source File: SamlTokenInterceptor.java    From steady with Apache License 2.0 6 votes vote down vote up
public void handleMessage(SoapMessage message) throws Fault {

        boolean isReq = MessageUtils.isRequestor(message);
        boolean isOut = MessageUtils.isOutbound(message);
        
        if (isReq != isOut) {
            //outbound on server side and inbound on client side doesn't need
            //any saml token stuff, assert policies and return
            assertSamlTokens(message);
            return;
        }
        if (isReq) {
            if (message.containsKey(PolicyBasedWSS4JOutInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            addSamlToken(message);
        } else {
            if (message.containsKey(WSS4JInInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            processSamlToken(message);
        }
    }
 
Example 8
Source File: UsernameTokenInterceptor.java    From steady with Apache License 2.0 6 votes vote down vote up
public void handleMessage(SoapMessage message) throws Fault {

        boolean isReq = MessageUtils.isRequestor(message);
        boolean isOut = MessageUtils.isOutbound(message);
        if (isReq != isOut) {
            //outbound on server side and inbound on client side doesn't need
            //any username token stuff, assert policies and return
            assertUsernameTokens(message, null);
            return;
        }
        if (isReq) {
            if (message.containsKey(PolicyBasedWSS4JOutInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            addUsernameToken(message);
        } else {
            if (message.containsKey(WSS4JInInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            processUsernameToken(message);
        }
    }
 
Example 9
Source File: DefaultLogEventMapper.java    From cxf with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the event type from message.
 *
 * @param message the message
 * @return the event type
 */
public EventType getEventType(Message message) {
    boolean isRequestor = MessageUtils.isRequestor(message);
    boolean isFault = MessageUtils.isFault(message);
    if (!isFault) {
        isFault = !isSOAPMessage(message) && isRESTFault(message);
    }
    boolean isOutbound = MessageUtils.isOutbound(message);
    if (isOutbound) {
        if (isFault) {
            return EventType.FAULT_OUT;
        }
        return isRequestor ? EventType.REQ_OUT : EventType.RESP_OUT;
    }
    if (isFault) {
        return EventType.FAULT_IN;
    }
    return isRequestor ? EventType.RESP_IN : EventType.REQ_IN;
}
 
Example 10
Source File: RMContextUtils.java    From cxf with Apache License 2.0 6 votes vote down vote up
/**
 * Retrieve the RM properties from the current message.
 *
 * @param message the current message
 * @param outbound true if the message direction is outbound
 * @return the RM properties
 */
public static RMProperties retrieveRMProperties(Message message, boolean outbound) {
    if (outbound) {
        return (RMProperties)message.get(getRMPropertiesKey(true));
    }
    Message m = null;
    if (MessageUtils.isOutbound(message)) {
        // the in properties are only available on the in message
        m = message.getExchange().getInMessage();
        if (null == m) {
            m = message.getExchange().getInFaultMessage();
        }
    } else {
        m = message;
    }
    if (null != m) {
        return (RMProperties)m.get(getRMPropertiesKey(false));
    }
    return null;

}
 
Example 11
Source File: AbstractTokenInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void handleMessage(SoapMessage message) throws Fault {

        boolean enableStax =
            MessageUtils.getContextualBoolean(message, SecurityConstants.ENABLE_STREAMING_SECURITY, false);
        if (enableStax) {
            return;
        }

        boolean isReq = MessageUtils.isRequestor(message);
        boolean isOut = MessageUtils.isOutbound(message);

        if (isReq != isOut) {
            //outbound on server side and inbound on client side doesn't need
            //any specific token stuff, assert policies and return
            assertTokens(message);
            return;
        }
        if (isReq) {
            if (message.containsKey(PolicyBasedWSS4JOutInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            addToken(message);
        } else {
            if (message.containsKey(WSS4JInInterceptor.SECURITY_PROCESSED)) {
                //The full policy interceptors handled this
                return;
            }
            processToken(message);
        }
    }
 
Example 12
Source File: ColocUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static MessageInfo getMessageInfo(Message message) {
    OperationInfo oi = message.getExchange().getBindingOperationInfo().getOperationInfo();
    if (MessageUtils.isOutbound(message)) {
        return oi.getOutput();
    }
    return oi.getInput();
}
 
Example 13
Source File: DefaultLogEventMapper.java    From cxf with Apache License 2.0 5 votes vote down vote up
private Message getEffectiveMessage(Message message) {
    boolean isRequestor = MessageUtils.isRequestor(message);
    boolean isOutbound = MessageUtils.isOutbound(message);
    if (isRequestor) {
        return isOutbound ? message : message.getExchange().getOutMessage();
    }
    return isOutbound ? message.getExchange().getInMessage() : message;
}
 
Example 14
Source File: MAPCodec.java    From cxf with Apache License 2.0 5 votes vote down vote up
/**
 * Mediate message flow, performing MAP {en|de}coding.
 *
 * @param message the message message
 */
private void mediate(SoapMessage message) {
    if (!MessageUtils.getContextualBoolean(message, MAPAggregator.ADDRESSING_DISABLED, false)) {
        if (ContextUtils.isOutbound(message)) {
            encode(message, ContextUtils.retrieveMAPs(message, false, true));
        } else if (null == ContextUtils.retrieveMAPs(message, false, false, false)) {
            AddressingProperties maps = decode(message);
            ContextUtils.storeMAPs(maps, message, false);
            markPartialResponse(message, maps);
            restoreExchange(message, maps);

            if (maps != null
                && !MessageUtils.isRequestor(message)
                && message.getExchange().getBindingOperationInfo() == null
                && !MessageUtils.isOutbound(message)
                && maps.getAction() != null) {
                //try and use the Action from the maps to find the operation
                String action = maps.getAction().getValue();
                if (action != null) {
                    boolean strict = MessageUtils.getContextualBoolean(message,
                                                                       "ws-addressing.strict.action.checking",
                                                                       false);
                    SoapActionInInterceptor.getAndSetOperation(message, action, strict);
                }
            }
        }
    }
}
 
Example 15
Source File: AbstractBraveInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
Message getEffectiveMessage() {
    boolean isRequestor = MessageUtils.isRequestor(message);
    boolean isOutbound = MessageUtils.isOutbound(message);
    if (isRequestor) {
        return isOutbound ? message : message.getExchange().getOutMessage();
    }
    return isOutbound ? message.getExchange().getInMessage() : message;
}
 
Example 16
Source File: MetricsMessageInPostInvokeInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
public void handleMessage(Message message) throws Fault {
    if (isRequestor(message) && !MessageUtils.isOutbound(message)) {
        stop(message);
    }
}
 
Example 17
Source File: ClientPolicyCalculator.java    From cxf with Apache License 2.0 4 votes vote down vote up
public boolean isAsserted(Message message, HTTPClientPolicy policy, HTTPClientPolicy refPolicy) {
    boolean outbound = MessageUtils.isOutbound(message);
    boolean compatible = compatible(policy, refPolicy);
    return !outbound || compatible;
}
 
Example 18
Source File: ServerPolicyCalculator.java    From cxf with Apache License 2.0 4 votes vote down vote up
public boolean isAsserted(Message message, HTTPServerPolicy policy, HTTPServerPolicy refPolicy) {
    return MessageUtils.isOutbound(message) || equals(policy, refPolicy);
}