Package org.apache.wss4j.policy.model

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


        if (!(tokenSecurityEvent instanceof RelTokenSecurityEvent)) {
            throw new WSSPolicyException("Expected a RelTokenSecurityEvent but got " + tokenSecurityEvent.getClass().getName());
        }

        RelTokenSecurityEvent relTokenSecurityEvent = (RelTokenSecurityEvent) tokenSecurityEvent;
        RelToken relToken = (RelToken) abstractToken;

        if (relToken.getIssuerName() != null && !relToken.getIssuerName().equals(relTokenSecurityEvent.getIssuerName())) {
            setErrorMessage("IssuerName in Policy (" + relToken.getIssuerName() + ") didn't match with the one in the RelToken (" + relTokenSecurityEvent.getIssuerName() + ")");
            return false;
        }

        //todo RequireKeyIdentifierReference
        //todo WssRelV*
 
View Full Code Here


        if (!(tokenSecurityEvent instanceof RelTokenSecurityEvent)) {
            throw new WSSPolicyException("Expected a RelTokenSecurityEvent but got " + tokenSecurityEvent.getClass().getName());
        }

        RelTokenSecurityEvent relTokenSecurityEvent = (RelTokenSecurityEvent) tokenSecurityEvent;
        RelToken relToken = (RelToken) abstractToken;

        if (relToken.getIssuerName() != null && !relToken.getIssuerName().equals(relTokenSecurityEvent.getIssuerName())) {
            setErrorMessage("IssuerName in Policy (" + relToken.getIssuerName() + ") didn't match with the one in the RelToken (" + relTokenSecurityEvent.getIssuerName() + ")");
            getPolicyAsserter().unassertPolicy(getAssertion(), getErrorMessage());
            return false;
        }

        //todo RequireKeyIdentifierReference
View Full Code Here

            throw new IllegalArgumentException(SPConstants.ERR_INVALID_POLICY);
        }
        final Element nestedPolicyElement = SPUtils.getFirstPolicyChildElement(element);
        final Element claims = SPUtils.getFirstChildElement(element, spVersion.getSPConstants().getClaims());
        final Policy nestedPolicy = nestedPolicyElement != null ? factory.getPolicyEngine().getPolicy(nestedPolicyElement) : new Policy();
        RelToken relToken = new RelToken(
                spVersion,
                spVersion.getSPConstants().getInclusionFromAttributeValue(includeTokenValue),
                issuer,
                issuerName,
                claims,
                nestedPolicy
        );
        relToken.setOptional(SPUtils.isOptional(element));
        relToken.setIgnorable(SPUtils.isIgnorable(element));
        return relToken;
    }
View Full Code Here

        if (!(tokenSecurityEvent instanceof RelTokenSecurityEvent)) {
            throw new WSSPolicyException("Expected a RelTokenSecurityEvent but got " + tokenSecurityEvent.getClass().getName());
        }

        RelTokenSecurityEvent relTokenSecurityEvent = (RelTokenSecurityEvent) tokenSecurityEvent;
        RelToken relToken = (RelToken) abstractToken;

        if (relToken.getIssuerName() != null && !relToken.getIssuerName().equals(relTokenSecurityEvent.getIssuerName())) {
            setErrorMessage("IssuerName in Policy (" + relToken.getIssuerName() + ") didn't match with the one in the RelToken (" + relTokenSecurityEvent.getIssuerName() + ")");
            return false;
        }

        //todo RequireKeyIdentifierReference
        //todo WssRelV*
 
View Full Code Here

        int count = 0;
        while (alternativeIterator.hasNext()) {
            List<Assertion> alternative = alternativeIterator.next();
            assertEquals(1, alternative.size());
            assertTrue(alternative.get(0) instanceof RelToken);
            RelToken relToken = (RelToken) alternative.get(0);
            assertFalse(relToken.isNormalized());
            assertTrue(relToken.isIgnorable());
            assertTrue(relToken.isOptional());
            assertEquals(Constants.TYPE_ASSERTION, relToken.getType());
            assertEquals(SP12Constants.REL_TOKEN, relToken.getName());
            assertEquals(RelToken.RelTokenType.WssRelV20Token10, relToken.getRelTokenType());
            assertTrue(relToken.isRequireKeyIdentifierReference());
            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();
        RelToken relToken = (RelToken) policyComponentIterator.next();
        assertTrue(relToken.isNormalized());
        assertTrue(relToken.isIgnorable());
        assertFalse(relToken.isOptional());
        assertEquals(Constants.TYPE_ASSERTION, relToken.getType());
        assertEquals(SP12Constants.REL_TOKEN, relToken.getName());
        assertEquals(RelToken.RelTokenType.WssRelV20Token10, relToken.getRelTokenType());
        assertTrue(relToken.isRequireKeyIdentifierReference());
    }
View Full Code Here

TOP

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

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.