Package org.apache.cxf.ws.policy

Examples of org.apache.cxf.ws.policy.AssertionInfoMap


                    message, SecurityConstants.MUST_UNDERSTAND, true
                );
            String actor = (String)message.getContextualProperty(SecurityConstants.ACTOR);
           

            AssertionInfoMap aim = message.get(AssertionInfoMap.class);
            // extract Assertion information
            if (aim != null) {
                Binding transport = null;
                ais = aim.get(SP12Constants.TRANSPORT_BINDING);
                if (ais != null) {
                    for (AssertionInfo ai : ais) {
                        transport = (Binding)ai.getAssertion();
                        ai.setAsserted(true);
                    }                   
                }
                ais = aim.get(SP12Constants.ASYMMETRIC_BINDING);
                if (ais != null) {
                    for (AssertionInfo ai : ais) {
                        transport = (Binding)ai.getAssertion();
                        ai.setAsserted(true);
                    }                   
                }
                ais = aim.get(SP12Constants.SYMMETRIC_BINDING);
                if (ais != null) {
                    for (AssertionInfo ai : ais) {
                        transport = (Binding)ai.getAssertion();
                        ai.setAsserted(true);
                    }                   
                }
                if (transport == null && isRequestor(message)) {
                    transport = new TransportBinding(SP12Constants.INSTANCE,
                                                     message.getExchange().getBus()
                                                         .getExtension(PolicyBuilder.class));
                }
               
                if (transport != null) {
                    WSSecHeader secHeader = new WSSecHeader(actor, mustUnderstand);
                    Element el = null;
                    try {
                        el = secHeader.insertSecurityHeader(saaj.getSOAPPart());
                    } catch (WSSecurityException e) {
                        throw new SoapFault(
                            new Message("SECURITY_FAILED", LOG), e, message.getVersion().getSender()
                        );
                    }
                    try {
                        //move to end
                        saaj.getSOAPHeader().removeChild(el);
                        saaj.getSOAPHeader().appendChild(el);
                    } catch (SOAPException e) {
                        //ignore
                    }
                   
                    WSSConfig config = (WSSConfig)message.getContextualProperty(WSSConfig.class.getName());
                    if (config == null) {
                        config = WSSConfig.getNewInstance();
                    }
                    translateProperties(message, config);

                    if (transport instanceof TransportBinding) {
                        new TransportBindingHandler(config, (TransportBinding)transport, saaj,
                                                    secHeader, aim, message).handleBinding();
                    } else if (transport instanceof SymmetricBinding) {
                        new SymmetricBindingHandler(config, (SymmetricBinding)transport, saaj,
                                                     secHeader, aim, message).handleBinding();
                    } else {
                        new AsymmetricBindingHandler(config, (AsymmetricBinding)transport, saaj,
                                                     secHeader, aim, message).handleBinding();
                    }
                   
                    if (el.getFirstChild() == null) {
                        el.getParentNode().removeChild(el);
                    }
                }
               
                ais = aim.get(SP12Constants.WSS10);
                if (ais != null) {
                    for (AssertionInfo ai : ais) {
                        ai.setAsserted(true);
                    }                   
                }
                ais = aim.get(SP12Constants.WSS11);
                if (ais != null) {
                    for (AssertionInfo ai : ais) {
                        ai.setAsserted(true);
                    }                   
                }
View Full Code Here


    private UsernameToken assertTokens(
        SoapMessage message,
        WSUsernameTokenPrincipal princ,
        boolean signed
    ) {
        AssertionInfoMap aim = message.get(AssertionInfoMap.class);
        Collection<AssertionInfo> ais = aim.getAssertionInfo(SP12Constants.USERNAME_TOKEN);
        UsernameToken tok = null;
        for (AssertionInfo ai : ais) {
            tok = (UsernameToken)ai.getAssertion();
            if (princ != null && tok.isHashPassword() != princ.isPasswordDigest()) {
                ai.setNotAsserted("Password hashing policy not enforced");
            } else if (princ != null && !tok.isNoPassword() && (princ.getPassword() == null)
                && isNonEndorsingSupportingToken(tok)) {
                ai.setNotAsserted("Username Token No Password supplied");
            } else {
                ai.setAsserted(true);        
            }
        }
        ais = aim.getAssertionInfo(SP12Constants.SUPPORTING_TOKENS);
        for (AssertionInfo ai : ais) {
            ai.setAsserted(true);
        }
        if (signed || isTLSInUse(message)) {
            ais = aim.getAssertionInfo(SP12Constants.SIGNED_SUPPORTING_TOKENS);
            for (AssertionInfo ai : ais) {
                ai.setAsserted(true);
            }
        }
        return tok;
View Full Code Here

        Header h = findSecurityHeader(message, true);
        WSSecUsernameToken utBuilder =
            addUsernameToken(message, tok);
        if (utBuilder == null) {
            AssertionInfoMap aim = message.get(AssertionInfoMap.class);
            Collection<AssertionInfo> ais = aim.getAssertionInfo(SP12Constants.USERNAME_TOKEN);
            for (AssertionInfo ai : ais) {
                if (ai.isAsserted()) {
                    ai.setAsserted(false);
                }
            }
View Full Code Here

                    message, SecurityConstants.MUST_UNDERSTAND, true
                );
            String actor = (String)message.getContextualProperty(SecurityConstants.ACTOR);
           

            AssertionInfoMap aim = message.get(AssertionInfoMap.class);
            // extract Assertion information
            if (aim != null) {
                Binding transport = null;
                ais = aim.get(SP12Constants.TRANSPORT_BINDING);
                if (ais != null) {
                    for (AssertionInfo ai : ais) {
                        transport = (Binding)ai.getAssertion();
                        ai.setAsserted(true);
                    }                   
                }
                ais = aim.get(SP12Constants.ASYMMETRIC_BINDING);
                if (ais != null) {
                    for (AssertionInfo ai : ais) {
                        transport = (Binding)ai.getAssertion();
                        ai.setAsserted(true);
                    }                   
                }
                ais = aim.get(SP12Constants.SYMMETRIC_BINDING);
                if (ais != null) {
                    for (AssertionInfo ai : ais) {
                        transport = (Binding)ai.getAssertion();
                        ai.setAsserted(true);
                    }                   
                }
                if (transport == null && isRequestor(message)) {
                    transport = new TransportBinding(SP12Constants.INSTANCE,
                                                     message.getExchange().getBus()
                                                         .getExtension(PolicyBuilder.class));
                }
               
                if (transport != null) {
                    WSSecHeader secHeader = new WSSecHeader(actor, mustUnderstand);
                    Element el = null;
                    try {
                        el = secHeader.insertSecurityHeader(saaj.getSOAPPart());
                    } catch (WSSecurityException e) {
                        throw new SoapFault(
                            new Message("SECURITY_FAILED", LOG), e, message.getVersion().getSender()
                        );
                    }
                    try {
                        //move to end
                        SAAJUtils.getHeader(saaj).removeChild(el);
                        SAAJUtils.getHeader(saaj).appendChild(el);
                    } catch (SOAPException e) {
                        //ignore
                    }
                   
                    WSSConfig config = (WSSConfig)message.getContextualProperty(WSSConfig.class.getName());
                    if (config == null) {
                        config = WSSConfig.getNewInstance();
                    }

                    translateProperties(message, config);
                   
                    String asymSignatureAlgorithm =
                        (String)message.getContextualProperty(SecurityConstants.ASYMMETRIC_SIGNATURE_ALGORITHM);
                    if (asymSignatureAlgorithm != null && transport.getAlgorithmSuite() != null) {
                        transport.getAlgorithmSuite().setAsymmetricSignature(asymSignatureAlgorithm);
                    }

                    if (transport instanceof TransportBinding) {
                        new TransportBindingHandler(config, (TransportBinding)transport, saaj,
                                                    secHeader, aim, message).handleBinding();
                    } else if (transport instanceof SymmetricBinding) {
                        new SymmetricBindingHandler(config, (SymmetricBinding)transport, saaj,
                                                     secHeader, aim, message).handleBinding();
                    } else {
                        new AsymmetricBindingHandler(config, (AsymmetricBinding)transport, saaj,
                                                     secHeader, aim, message).handleBinding();
                    }
                   
                    if (el.getFirstChild() == null) {
                        el.getParentNode().removeChild(el);
                    }
                }
               
                ais = aim.get(SP12Constants.WSS10);
                if (ais != null) {
                    for (AssertionInfo ai : ais) {
                        ai.setAsserted(true);
                    }                   
                }
                ais = aim.get(SP12Constants.WSS11);
                if (ais != null) {
                    for (AssertionInfo ai : ais) {
                        ai.setAsserted(true);
                    }                   
                }
View Full Code Here

    public PolicyBasedWSS4JInInterceptor() {
        super(true);
    }
   
    public void handleMessage(SoapMessage msg) throws Fault {
        AssertionInfoMap aim = msg.get(AssertionInfoMap.class);
        if (aim != null) {
            super.handleMessage(msg);
        }
    }
View Full Code Here

    /**
     * Is a Nonce Cache required, i.e. are we expecting a UsernameToken
     */
    @Override
    protected boolean isNonceCacheRequired(int doAction, SoapMessage msg) {
        AssertionInfoMap aim = msg.get(AssertionInfoMap.class);
        if (aim != null) {
            Collection<AssertionInfo> ais = aim.get(SP12Constants.USERNAME_TOKEN);
           
            if (ais != null && !ais.isEmpty()) {
                return true;
            }
        }
View Full Code Here

    /**
     * Is a Timestamp cache required, i.e. are we expecting a Timestamp
     */
    @Override
    protected boolean isTimestampCacheRequired(int doAction, SoapMessage msg) {
        AssertionInfoMap aim = msg.get(AssertionInfoMap.class);
        if (aim != null) {
            Collection<AssertionInfo> ais = aim.get(SP12Constants.INCLUDE_TIMESTAMP);
           
            if (ais != null && !ais.isEmpty()) {
                return true;
            }
        }
View Full Code Here

    /**
     * Is a SAML Cache required, i.e. are we expecting a SAML Token
     */
    @Override
    protected boolean isSamlCacheRequired(int doAction, SoapMessage msg) {
        AssertionInfoMap aim = msg.get(AssertionInfoMap.class);
        if (aim != null) {
            Collection<AssertionInfo> ais = aim.get(SP12Constants.SAML_TOKEN);
           
            if (ais != null && !ais.isEmpty()) {
                return true;
            }
        }
View Full Code Here

    protected void computeAction(SoapMessage message, RequestData data) throws WSSecurityException {
        String action = getString(WSHandlerConstants.ACTION, message);
        if (action == null) {
            action = "";
        }
        AssertionInfoMap aim = message.get(AssertionInfoMap.class);
        if (aim != null) {
            //things that DO impact setup
            handleWSS11(aim, message);
            action = checkAsymmetricBinding(aim, action, message);
            action = checkSymmetricBinding(aim, action, message);
            Collection<AssertionInfo> ais = aim.get(SP12Constants.TRANSPORT_BINDING);
            if ("".equals(action) || (ais != null && !ais.isEmpty())) {
                action = checkDefaultBinding(aim, action, message);
            }
           
            // Allow for setting non-standard asymmetric signature algorithms
View Full Code Here

        Element soapHeader,
        Element soapBody,
        List<WSSecurityEngineResult> results,
        boolean utWithCallbacks
    ) throws SOAPException, XMLStreamException, WSSecurityException {
        AssertionInfoMap aim = msg.get(AssertionInfoMap.class);
        Collection<WSDataRef> signed = new HashSet<WSDataRef>();
        Collection<WSDataRef> encrypted = new HashSet<WSDataRef>();
       
        //
        // Pre-fetch various results
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.policy.AssertionInfoMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.