Package org.apache.wss4j.policy.model

Examples of org.apache.wss4j.policy.model.TransportBinding


        }
       
        super.configureProperties(msg, outboundSecurityContext, securityProperties);
       
        if (transAis != null) {
            TransportBinding binding = (TransportBinding)transAis.getAssertion();
            new StaxTransportBindingHandler(
                securityProperties, msg, binding, outboundSecurityContext).handleBinding();
        } else if (asymAis != null) {
            AsymmetricBinding binding = (AsymmetricBinding)asymAis.getAssertion();
            new StaxAsymmetricBindingHandler(
View Full Code Here


                    }                   
                }

                if (transport == null && isRequestor(message)) {
                    Policy policy = new Policy();
                    transport = new TransportBinding(org.apache.wss4j.policy.SPConstants.SPVersion.SP11,
                                                     policy);
                }
               
                if (transport != null) {
                    WSSecHeader secHeader = new WSSecHeader(actor, mustUnderstand);
View Full Code Here

        final Element nestedPolicyElement = SPUtils.getFirstPolicyChildElement(element);
        if (nestedPolicyElement == null) {
            throw new IllegalArgumentException("sp:TransportBinding must have an inner wsp:Policy element");
        }
        final Policy nestedPolicy = factory.getPolicyEngine().getPolicy(nestedPolicyElement);
        TransportBinding transportBinding = new TransportBinding(
                spVersion,
                nestedPolicy
        );
        transportBinding.setOptional(SPUtils.isOptional(element));
        transportBinding.setIgnorable(SPUtils.isIgnorable(element));
        return transportBinding;
    }
View Full Code Here

        int count = 0;
        while (alternativeIterator.hasNext()) {
            List<Assertion> alternative = alternativeIterator.next();
            assertEquals(1, alternative.size());
            assertTrue(alternative.get(0) instanceof TransportBinding);
            TransportBinding transportBinding = (TransportBinding) alternative.get(0);
            assertFalse(transportBinding.isNormalized());
            assertTrue(transportBinding.isIgnorable());
            assertTrue(transportBinding.isOptional());
            assertEquals(Constants.TYPE_ASSERTION, transportBinding.getType());
            assertEquals(SP12Constants.TRANSPORT_BINDING, transportBinding.getName());
            assertNotNull(transportBinding.getTransportToken());
            assertNotNull(transportBinding.getAlgorithmSuite());
            assertNotNull(transportBinding.getLayout());
            assertTrue(transportBinding.isIncludeTimestamp());
            count++;
        }
        assertEquals(1, count);

        policy = policy.normalize(true);
        serializedPolicy = serializePolicy(policy);
        assertXMLisEqual(serializedPolicy, normalizedPolicyReferenceFile);

        alternativeIterator = policy.getAlternatives();
        List<Assertion> alternative = alternativeIterator.next();
        assertEquals(0, alternative.size());

        List<PolicyComponent> policyComponents = policy.getPolicyComponents();
        assertEquals(1, policyComponents.size());
        PolicyOperator policyOperator = (PolicyOperator) policyComponents.get(0);
        policyComponents = policyOperator.getPolicyComponents();
        assertEquals(2, policyComponents.size());
        All all = (All) policyComponents.get(0);
        List<PolicyComponent> policyComponentsAll = all.getAssertions();
        assertEquals(0, policyComponentsAll.size());

        all = (All) policyComponents.get(1);
        policyComponentsAll = all.getAssertions();
        assertEquals(1, policyComponentsAll.size());

        Iterator<PolicyComponent> policyComponentIterator = policyComponentsAll.iterator();
        TransportBinding transportBinding = (TransportBinding) policyComponentIterator.next();
        assertTrue(transportBinding.isNormalized());
        assertTrue(transportBinding.isIgnorable());
        assertFalse(transportBinding.isOptional());
        assertEquals(Constants.TYPE_ASSERTION, transportBinding.getType());
        assertEquals(SP12Constants.TRANSPORT_BINDING, transportBinding.getName());
        assertNotNull(transportBinding.getTransportToken());
        assertNotNull(transportBinding.getAlgorithmSuite());
        assertNotNull(transportBinding.getLayout());
        assertTrue(transportBinding.isIncludeTimestamp());
    }
View Full Code Here

        }
       
        super.configureProperties(msg, outboundTokens);
       
        if (!transAis.isEmpty()) {
            TransportBinding binding = (TransportBinding)transAis.iterator().next().getAssertion();
            new StaxTransportBindingHandler(getProperties(), msg, binding, outboundTokens).handleBinding();
        } else if (!asymAis.isEmpty()) {
            AsymmetricBinding binding = (AsymmetricBinding)asymAis.iterator().next().getAssertion();
            new StaxAsymmetricBindingHandler(getProperties(), msg, binding, outboundTokens).handleBinding();
        } else if (!symAis.isEmpty()) {
View Full Code Here

        Message message,
        List<WSSecurityEngineResult> results,
        List<WSSecurityEngineResult> signedResults
    ) {
        for (AssertionInfo ai : ais) {
            TransportBinding binding = (TransportBinding)ai.getAssertion();
            ai.setAsserted(true);
           
            // Check that TLS is in use if we are not the requestor
            boolean initiator = MessageUtils.isRequestor(message);
            TLSSessionInfo tlsInfo = message.get(TLSSessionInfo.class);
            if (!initiator && tlsInfo == null) {
                ai.setNotAsserted("TLS is not enabled");
                continue;
            }
           
            // HttpsToken is validated by the HttpsTokenInterceptorProvider
            if (binding.getTransportToken() != null) {
                assertPolicy(aim, binding.getTransportToken());
            }
           
            // Check the AlgorithmSuite
            AlgorithmSuitePolicyValidator algorithmValidator = new AlgorithmSuitePolicyValidator(results);
            if (!algorithmValidator.validatePolicy(ai, binding.getAlgorithmSuite())) {
                continue;
            }
            assertPolicy(aim, binding.getAlgorithmSuite());
            String namespace = binding.getAlgorithmSuite().getVersion().getNamespace();
            String name = binding.getAlgorithmSuite().getAlgorithmSuiteType().getName();
            Collection<AssertionInfo> algSuiteAis = aim.get(new QName(namespace, name));
            if (algSuiteAis != null) {
                for (AssertionInfo algSuiteAi : algSuiteAis) {
                    algSuiteAi.setAsserted(true);
                }
            }
           
            // Check the IncludeTimestamp
            if (!validateTimestamp(binding.isIncludeTimestamp(), true, results, signedResults, message)) {
                String error = "Received Timestamp does not match the requirements";
                ai.setNotAsserted(error);
                continue;
            }
            assertPolicy(aim, SPConstants.INCLUDE_TIMESTAMP);
           
            // Check the Layout
            Layout layout = binding.getLayout();
            LayoutPolicyValidator layoutValidator = new LayoutPolicyValidator(results, signedResults);
            if (!layoutValidator.validatePolicy(layout)) {
                String error = "Layout does not match the requirements";
                notAssertPolicy(aim, binding.getLayout(), error);
                ai.setNotAsserted(error);
                continue;
            }
            assertPolicy(aim, binding.getLayout());
            assertPolicy(aim, SPConstants.LAYOUT_LAX);
            assertPolicy(aim, SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST);
            assertPolicy(aim, SPConstants.LAYOUT_LAX_TIMESTAMP_LAST);
            assertPolicy(aim, SPConstants.LAYOUT_STRICT);
        }
View Full Code Here

                    }                   
                }

                if (transport == null && isRequestor(message)) {
                    Policy policy = new Policy();
                    transport = new TransportBinding(org.apache.wss4j.policy.SPConstants.SPVersion.SP11,
                                                     policy);
                }
               
                if (transport != null) {
                    WSSecHeader secHeader = new WSSecHeader(actor, mustUnderstand);
View Full Code Here

                    }                   
                }

                if (transport == null && isRequestor(message)) {
                    Policy policy = new Policy();
                    transport = new TransportBinding(org.apache.wss4j.policy.SPConstants.SPVersion.SP11,
                                                     policy);
                }
               
                if (transport != null) {
                    WSSecHeader secHeader = new WSSecHeader(actor, mustUnderstand);
View Full Code Here

        }
       
        super.configureProperties(msg, outboundSecurityContext, securityProperties);
       
        if (transAis != null) {
            TransportBinding binding = (TransportBinding)transAis.getAssertion();
            new StaxTransportBindingHandler(
                securityProperties, msg, binding, outboundSecurityContext).handleBinding();
        } else if (asymAis != null) {
            AsymmetricBinding binding = (AsymmetricBinding)asymAis.getAssertion();
            new StaxAsymmetricBindingHandler(
View Full Code Here

        Message message,
        List<WSSecurityEngineResult> results,
        List<WSSecurityEngineResult> signedResults
    ) {
        for (AssertionInfo ai : ais) {
            TransportBinding binding = (TransportBinding)ai.getAssertion();
            ai.setAsserted(true);
           
            // Check that TLS is in use if we are not the requestor
            boolean initiator = MessageUtils.isRequestor(message);
            TLSSessionInfo tlsInfo = message.get(TLSSessionInfo.class);
            if (!initiator && tlsInfo == null) {
                ai.setNotAsserted("TLS is not enabled");
                continue;
            }
           
            // HttpsToken is validated by the HttpsTokenInterceptorProvider
            if (binding.getTransportToken() != null) {
                assertPolicy(aim, binding.getTransportToken());
            }
           
            // Check the IncludeTimestamp
            if (!validateTimestamp(binding.isIncludeTimestamp(), true, results, signedResults, message)) {
                String error = "Received Timestamp does not match the requirements";
                ai.setNotAsserted(error);
                continue;
            }
            assertPolicy(aim, SPConstants.INCLUDE_TIMESTAMP);
View Full Code Here

TOP

Related Classes of org.apache.wss4j.policy.model.TransportBinding

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.