Examples of Wss11


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

        if (isRequestor(message)) {
            message.put(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "false");
            Collection<AssertionInfo> ais = getAllAssertionsByLocalname(aim, SPConstants.WSS11);
            if (!ais.isEmpty()) {
                for (AssertionInfo ai : ais) {
                    Wss11 wss11 = (Wss11)ai.getAssertion();
                    if (wss11.isRequireSignatureConfirmation()) {
                        message.put(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "true");
                        break;
                    }
                }
            }
View Full Code Here

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

            if (wss10.isMustSupportRefKeyIdentifier()) {
                policyAsserter.assertPolicy(new QName(namespace, SPConstants.MUST_SUPPORT_REF_KEY_IDENTIFIER));
            }
           
            if (abstractSecurityAssertion instanceof Wss11) {
                Wss11 wss11 = (Wss11)abstractSecurityAssertion;
                if (wss11.isMustSupportRefEncryptedKey()) {
                    policyAsserter.assertPolicy(new QName(namespace, SPConstants.MUST_SUPPORT_REF_ENCRYPTED_KEY));
                }
                if (wss11.isMustSupportRefThumbprint()) {
                    policyAsserter.assertPolicy(new QName(namespace, SPConstants.MUST_SUPPORT_REF_THUMBPRINT));
                }
                if (wss11.isRequireSignatureConfirmation()) {
                    assertableList.add(new SignatureConfirmationAssertionState(wss11, policyAsserter, true));
                    if (initiator) {
                        //9 WSS: SOAP Message Security Options [Signature Confirmation]
                        List<QName> signatureConfirmationElementPath = new LinkedList<QName>();
                        signatureConfirmationElementPath.addAll(WSSConstants.WSSE_SECURITY_HEADER_PATH);
View Full Code Here

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

        };
    }

    @Override
    public boolean assertEvent(SecurityEvent securityEvent) throws WSSPolicyException {
        Wss11 wss11 = (Wss11)getAssertion();

        String namespace = getAssertion().getName().getNamespaceURI();
        if (wss11.isRequireSignatureConfirmation()) {
            policyAsserter.assertPolicy(new QName(namespace, SPConstants.REQUIRE_SIGNATURE_CONFIRMATION));
            setAsserted(true);
        } else {
            setAsserted(false);
            setErrorMessage("Signature confirmation elements must not be used");
View Full Code Here

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

        int count = 0;
        while (alternativeIterator.hasNext()) {
            List<Assertion> alternative = alternativeIterator.next();
            assertEquals(1, alternative.size());
            assertTrue(alternative.get(0) instanceof Wss11);
            Wss11 wss11 = (Wss11) alternative.get(0);
            assertFalse(wss11.isNormalized());
            assertTrue(wss11.isIgnorable());
            assertTrue(wss11.isOptional());
            assertEquals(Constants.TYPE_ASSERTION, wss11.getType());
            assertEquals(SP12Constants.WSS11, wss11.getName());
            assertTrue(wss11.isMustSupportRefEmbeddedToken());
            assertTrue(wss11.isMustSupportRefExternalURI());
            assertTrue(wss11.isMustSupportRefIssuerSerial());
            assertTrue(wss11.isMustSupportRefKeyIdentifier());
            assertTrue(wss11.isMustSupportRefEncryptedKey());
            assertTrue(wss11.isMustSupportRefThumbprint());
            assertTrue(wss11.isRequireSignatureConfirmation());
            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();
        Wss11 wss11 = (Wss11) policyComponentIterator.next();
        assertTrue(wss11.isNormalized());
        assertTrue(wss11.isIgnorable());
        assertFalse(wss11.isOptional());
        assertEquals(Constants.TYPE_ASSERTION, wss11.getType());
        assertEquals(SP12Constants.WSS11, wss11.getName());
        assertTrue(wss11.isMustSupportRefEmbeddedToken());
        assertTrue(wss11.isMustSupportRefExternalURI());
        assertTrue(wss11.isMustSupportRefIssuerSerial());
        assertTrue(wss11.isMustSupportRefKeyIdentifier());
        assertTrue(wss11.isMustSupportRefEncryptedKey());
        assertTrue(wss11.isMustSupportRefThumbprint());
        assertTrue(wss11.isRequireSignatureConfirmation());
    }
View Full Code Here

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

    public Assertion build(Element element, AssertionBuilderFactory factory) throws IllegalArgumentException {

        final SPConstants.SPVersion spVersion = SPConstants.SPVersion.getSPVersion(element.getNamespaceURI());
        final Element nestedPolicyElement = SPUtils.getFirstPolicyChildElement(element);
        final Policy nestedPolicy = nestedPolicyElement != null ? factory.getPolicyEngine().getPolicy(nestedPolicyElement) : new Policy();
        Wss11 wss11 = new Wss11(
                spVersion,
                nestedPolicy
        );
        wss11.setOptional(SPUtils.isOptional(element));
        wss11.setIgnorable(SPUtils.isIgnorable(element));
        return wss11;
    }
View Full Code Here

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

                SignedElementsAssertionState signedElementsAssertionState = new SignedElementsAssertionState(abstractSecurityAssertion, true);
                signedElementsAssertionState.addElement(timestampElementPath);
                assertableList.add(signedElementsAssertionState);
            }
        } else if (abstractSecurityAssertion instanceof Wss11) {
            Wss11 wss11 = (Wss11)abstractSecurityAssertion;

            if (initiator) {
                //9 WSS: SOAP Message Security Options [Signature Confirmation]
                assertableList.add(new SignatureConfirmationAssertionState(wss11, true));
                if (wss11.isRequireSignatureConfirmation()) {
                    List<QName> signatureConfirmationElementPath = new LinkedList<QName>();
                    signatureConfirmationElementPath.addAll(WSSConstants.WSSE_SECURITY_HEADER_PATH);
                    signatureConfirmationElementPath.add(WSSConstants.TAG_wsse11_SignatureConfirmation);
                    RequiredElementsAssertionState requiredElementsAssertionState = new RequiredElementsAssertionState(wss11, false);
                    requiredElementsAssertionState.addElement(signatureConfirmationElementPath);
View Full Code Here

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

        };
    }

    @Override
    public boolean assertEvent(SecurityEvent securityEvent) throws WSSPolicyException {
        Wss11 wss11 = (Wss11)getAssertion();

        if (wss11.isRequireSignatureConfirmation()) {
            setAsserted(true);
        } else {
            setAsserted(false);
            setErrorMessage("Signature confirmation elements must not be used");
        }
View Full Code Here

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

        if (isRequestor(message)) {
            message.put(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "false");
            Collection<AssertionInfo> ais = getAllAssertionsByLocalname(aim, SPConstants.WSS11);
            if (!ais.isEmpty()) {
                for (AssertionInfo ai : ais) {
                    Wss11 wss11 = (Wss11)ai.getAssertion();
                    if (wss11.isRequireSignatureConfirmation()) {
                        message.put(WSHandlerConstants.ENABLE_SIGNATURE_CONFIRMATION, "true");
                        break;
                    }
                }
            }
View Full Code Here

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

    ) {
        List<WSSecurityEngineResult> scResults =
            WSSecurityUtil.fetchAllActionResults(results, WSConstants.SC);
       
        for (AssertionInfo ai : ais) {
            Wss11 wss11 = (Wss11)ai.getAssertion();
            ai.setAsserted(true);

            if (!MessageUtils.isRequestor(message)) {
                continue;
            }
           
            if ((wss11.isRequireSignatureConfirmation() && scResults.isEmpty())
                || (!wss11.isRequireSignatureConfirmation() && !scResults.isEmpty())) {
                ai.setNotAsserted(
                    "Signature Confirmation policy validation failed"
                );
                continue;
            }
View Full Code Here

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

       
        Collection<AssertionInfo> wss11Ais = aim.get(new QName(namespace, SPConstants.WSS11));
        if (wss11Ais != null) {
            for (AssertionInfo ai : wss11Ais) {
                ai.setAsserted(true);
                Wss11 wss11 = (Wss11)ai.getAssertion();
                assertWSS10Properties(wss11);
               
                if (wss11.isMustSupportRefThumbprint()) {
                    assertPolicy(new QName(namespace, SPConstants.MUST_SUPPORT_REF_THUMBPRINT));
                }
                if (wss11.isMustSupportRefEncryptedKey()) {
                    assertPolicy(new QName(namespace, SPConstants.MUST_SUPPORT_REF_ENCRYPTED_KEY));
                }
                if (wss11.isRequireSignatureConfirmation()) {
                    assertPolicy(new QName(namespace, SPConstants.REQUIRE_SIGNATURE_CONFIRMATION));
                }
            }
        }
    }
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.