Examples of AsymmetricBinding


Examples of org.apache.ws.secpolicy.model.AsymmetricBinding

public class AsymmetricBindingBuilder implements AssertionBuilder<OMElement> {

    public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException {
       
        AsymmetricBinding asymmetricBinding =  new AsymmetricBinding(SPConstants.SP_V12);
       
        Policy policy = PolicyEngine.getPolicy(element.getFirstElement());
        policy = (Policy) policy.normalize(false);
       
        for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
View Full Code Here

Examples of org.apache.ws.secpolicy.model.AsymmetricBinding

public class AsymmetricBindingBuilder implements AssertionBuilder {

    public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException {
       
        AsymmetricBinding asymmetricBinding =  new AsymmetricBinding(SPConstants.SP_V12);
       
        Policy policy = PolicyEngine.getPolicy(element.getFirstElement());
        policy = (Policy) policy.normalize(false);
       
        for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
View Full Code Here

Examples of org.apache.ws.secpolicy.model.AsymmetricBinding

public class AsymmetricBindingBuilder implements AssertionBuilder {

    public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException {
       
        AsymmetricBinding asymmetricBinding =  new AsymmetricBinding(SPConstants.SP_V11);
       
        Policy policy = PolicyEngine.getPolicy(element.getFirstElement());
        policy = (Policy) policy.normalize(false);
       
        for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
View Full Code Here

Examples of org.apache.ws.security.policy.model.AsymmetricBinding

            boolean asymmBindingfound = false, wss11found = false, signedPartsFound = false, encryptedPartsFound = false;
            while (pedIter.hasNext()) {
                PolicyEngineData ped = (PolicyEngineData) pedIter.next();
                if(ped instanceof AsymmetricBinding) {
                    asymmBindingfound = true;
                    AsymmetricBinding symmetricBinding = (AsymmetricBinding)ped;
                    assertEquals("Incorrect layout",Constants.LAYOUT_STRICT ,symmetricBinding.getLayout().getValue());
                } else if(ped instanceof Wss11) {
                    wss11found = true;
                    Wss11 wss11 = (Wss11)ped;
                    assertEquals("Signature confirmation must be true", true,
                            wss11.isRequireSignatureConfirmation());
View Full Code Here

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

    // See https://issues.apache.org/jira/browse/WSS-222
    protected void verifySignatureAlgorithms(Document signedDoc, AssertionInfoMap aim) throws Exception {
        final AssertionInfo assertInfo = aim.get(SP12Constants.ASYMMETRIC_BINDING).iterator().next();
        assertNotNull(assertInfo);
       
        final AsymmetricBinding binding = (AsymmetricBinding) assertInfo.getAssertion();
        final String expectedSignatureMethod = binding.getAlgorithmSuite().getAsymmetricSignature();
        final String expectedDigestAlgorithm =
            binding.getAlgorithmSuite().getAlgorithmSuiteType().getDigest();
        final String expectedCanonAlgorithm  = binding.getAlgorithmSuite().getC14n().getValue();
           
        XPathFactory factory = XPathFactory.newInstance();
        XPath xpath = factory.newXPath();
        final NamespaceContext nsContext = this.getNamespaceContext();
        xpath.setNamespaceContext(nsContext);
View Full Code Here

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

        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(
                securityProperties, msg, binding, outboundSecurityContext).handleBinding();
        } else if (symAis != null) {
            SymmetricBinding binding = (SymmetricBinding)symAis.getAssertion();
            new StaxSymmetricBindingHandler(
View Full Code Here

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

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

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

        int count = 0;
        while (alternativeIterator.hasNext()) {
            List<Assertion> alternative = alternativeIterator.next();
            assertEquals(1, alternative.size());
            assertTrue(alternative.get(0) instanceof AsymmetricBinding);
            AsymmetricBinding asymmetricBinding = (AsymmetricBinding) alternative.get(0);
            assertFalse(asymmetricBinding.isNormalized());
            assertTrue(asymmetricBinding.isIgnorable());
            assertTrue(asymmetricBinding.isOptional());
            assertEquals(Constants.TYPE_ASSERTION, asymmetricBinding.getType());
            assertEquals(SP12Constants.ASYMMETRIC_BINDING, asymmetricBinding.getName());
            assertNotNull(asymmetricBinding.getInitiatorEncryptionToken());
            assertNotNull(asymmetricBinding.getInitiatorSignatureToken());
            assertNull(asymmetricBinding.getInitiatorToken());
            assertNotNull(asymmetricBinding.getRecipientEncryptionToken());
            assertNotNull(asymmetricBinding.getRecipientSignatureToken());
            assertNull(asymmetricBinding.getRecipientToken());
            assertNotNull(asymmetricBinding.getAlgorithmSuite());
            assertNotNull(asymmetricBinding.getLayout());
            assertEquals(AbstractSymmetricAsymmetricBinding.ProtectionOrder.EncryptBeforeSigning, asymmetricBinding.getProtectionOrder());
            assertTrue(asymmetricBinding.isEncryptSignature());
            assertTrue(asymmetricBinding.isIncludeTimestamp());
            assertTrue(asymmetricBinding.isOnlySignEntireHeadersAndBody());
            assertTrue(asymmetricBinding.isProtectTokens());
            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();
        AsymmetricBinding asymmetricBinding = (AsymmetricBinding) policyComponentIterator.next();
        assertTrue(asymmetricBinding.isNormalized());
        assertTrue(asymmetricBinding.isIgnorable());
        assertFalse(asymmetricBinding.isOptional());
        assertEquals(Constants.TYPE_ASSERTION, asymmetricBinding.getType());
        assertEquals(SP12Constants.ASYMMETRIC_BINDING, asymmetricBinding.getName());
        assertNotNull(asymmetricBinding.getInitiatorEncryptionToken());
        assertNotNull(asymmetricBinding.getInitiatorSignatureToken());
        assertNull(asymmetricBinding.getInitiatorToken());
        assertNotNull(asymmetricBinding.getRecipientEncryptionToken());
        assertNotNull(asymmetricBinding.getRecipientSignatureToken());
        assertNull(asymmetricBinding.getRecipientToken());
        assertNotNull(asymmetricBinding.getAlgorithmSuite());
        assertNotNull(asymmetricBinding.getLayout());
        assertEquals(AbstractSymmetricAsymmetricBinding.ProtectionOrder.EncryptBeforeSigning, asymmetricBinding.getProtectionOrder());
        assertTrue(asymmetricBinding.isEncryptSignature());
        assertTrue(asymmetricBinding.isIncludeTimestamp());
        assertTrue(asymmetricBinding.isOnlySignEntireHeadersAndBody());
        assertTrue(asymmetricBinding.isProtectTokens());
    }
View Full Code Here

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

       
        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()) {
            SymmetricBinding binding = (SymmetricBinding)symAis.iterator().next().getAssertion();
            new StaxSymmetricBindingHandler(getProperties(), msg, binding, outboundTokens).handleBinding();
        } else {
View Full Code Here

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

    // See https://issues.apache.org/jira/browse/WSS-222
    protected void verifySignatureAlgorithms(Document signedDoc, AssertionInfoMap aim) throws Exception {
        final AssertionInfo assertInfo = aim.get(SP12Constants.ASYMMETRIC_BINDING).iterator().next();
        assertNotNull(assertInfo);
       
        final AsymmetricBinding binding = (AsymmetricBinding) assertInfo.getAssertion();
        final String expectedSignatureMethod = binding.getAlgorithmSuite().getAsymmetricSignature();
        final String expectedDigestAlgorithm =
            binding.getAlgorithmSuite().getAlgorithmSuiteType().getDigest();
        final String expectedCanonAlgorithm  = binding.getAlgorithmSuite().getC14n().getValue();
           
        XPathFactory factory = XPathFactory.newInstance();
        XPath xpath = factory.newXPath();
        final NamespaceContext nsContext = this.getNamespaceContext();
        xpath.setNamespaceContext(nsContext);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.