Package org.apache.cxf.ws.security.policy.model

Examples of org.apache.cxf.ws.security.policy.model.SpnegoContextToken


    public Assertion build(Element element, AssertionBuilderFactory factory)
        throws IllegalArgumentException {
        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
                ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
       
        SpnegoContextToken spnegoContextToken = new SpnegoContextToken(consts);
        spnegoContextToken.setOptional(PolicyConstants.isOptional(element));
        spnegoContextToken.setIgnorable(PolicyConstants.isIgnorable(element));
       
        String attribute = DOMUtils.getAttribute(element, consts.getIncludeToken());
        if (attribute == null) {
            throw new IllegalArgumentException("SpnegoContextToken doesn't contain "
                                               + "any sp:IncludeToken attribute");
        }

        String inclusionValue = attribute.trim();

        spnegoContextToken.setInclusion(consts.getInclusionFromAttributeValue(inclusionValue));

        Element elem = DOMUtils.getFirstElement(element);
        while (elem != null) {
            QName qn = DOMUtils.getElementQName(elem);
            if (Constants.isPolicyElement(qn)) {
                if (DOMUtils.getFirstChildWithName(elem, consts.getNamespace(),
                        SPConstants.REQUIRE_DERIVED_KEYS) != null) {
                    spnegoContextToken.setDerivedKeys(true);
                } else if (DOMUtils.getFirstChildWithName(elem,
                        SP12Constants.REQUIRE_IMPLIED_DERIVED_KEYS) != null) {
                    spnegoContextToken.setImpliedDerivedKeys(true);
                } else if (DOMUtils.getFirstChildWithName(elem,
                        SP12Constants.REQUIRE_EXPLICIT_DERIVED_KEYS) != null) {
                    spnegoContextToken.setExplicitDerivedKeys(true);
                }
            } else if (consts.getNamespace().equals(qn.getNamespaceURI())
                    && SPConstants.ISSUER.equals(qn.getLocalPart())) {
                spnegoContextToken.setIssuerEpr(DOMUtils.getFirstElement(elem));
            }
            elem = DOMUtils.getNextElement(elem);
        }
        return spnegoContextToken;
    }
View Full Code Here


    public Assertion build(Element element, AssertionBuilderFactory factory)
        throws IllegalArgumentException {
        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
                ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
       
        SpnegoContextToken spnegoContextToken = new SpnegoContextToken(consts);
        spnegoContextToken.setOptional(PolicyConstants.isOptional(element));
        spnegoContextToken.setIgnorable(PolicyConstants.isIgnorable(element));
       
        String attribute = DOMUtils.getAttribute(element, consts.getIncludeToken());
        if (attribute != null) {
            spnegoContextToken.setInclusion(consts.getInclusionFromAttributeValue(attribute.trim()));
        }

        Element elem = DOMUtils.getFirstElement(element);
        boolean foundPolicy = false;
        while (elem != null) {
            QName qn = DOMUtils.getElementQName(elem);
            if (Constants.isPolicyElement(qn)) {
                foundPolicy = true;
                spnegoContextToken.setPolicy(elem);
                if (DOMUtils.getFirstChildWithName(elem, consts.getNamespace(),
                        SPConstants.REQUIRE_DERIVED_KEYS) != null) {
                    spnegoContextToken.setDerivedKeys(true);
                } else if (DOMUtils.getFirstChildWithName(elem,
                        SP12Constants.REQUIRE_IMPLIED_DERIVED_KEYS) != null) {
                    spnegoContextToken.setImpliedDerivedKeys(true);
                } else if (DOMUtils.getFirstChildWithName(elem,
                        SP12Constants.REQUIRE_EXPLICIT_DERIVED_KEYS) != null) {
                    spnegoContextToken.setExplicitDerivedKeys(true);
                }
            } else if (consts.getNamespace().equals(qn.getNamespaceURI())
                    && SPConstants.ISSUER.equals(qn.getLocalPart())) {
                spnegoContextToken.setIssuerEpr(DOMUtils.getFirstElement(elem));
            }
            elem = DOMUtils.getNextElement(elem);
        }
       
        if (!foundPolicy && consts != SP11Constants.INSTANCE) {
View Full Code Here

    public Assertion build(Element element, AssertionBuilderFactory factory)
        throws IllegalArgumentException {
        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
                ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
       
        SpnegoContextToken spnegoContextToken = new SpnegoContextToken(consts);
        spnegoContextToken.setOptional(PolicyConstants.isOptional(element));
        spnegoContextToken.setIgnorable(PolicyConstants.isIgnorable(element));
       
        String attribute = DOMUtils.getAttribute(element, consts.getIncludeToken());
        if (attribute != null) {
            spnegoContextToken.setInclusion(consts.getInclusionFromAttributeValue(attribute.trim()));
        }

        Element elem = DOMUtils.getFirstElement(element);
        boolean foundPolicy = false;
        while (elem != null) {
            QName qn = DOMUtils.getElementQName(elem);
            if (Constants.isPolicyElement(qn)) {
                foundPolicy = true;
                if (DOMUtils.getFirstChildWithName(elem, consts.getNamespace(),
                        SPConstants.REQUIRE_DERIVED_KEYS) != null) {
                    spnegoContextToken.setDerivedKeys(true);
                } else if (DOMUtils.getFirstChildWithName(elem,
                        SP12Constants.REQUIRE_IMPLIED_DERIVED_KEYS) != null) {
                    spnegoContextToken.setImpliedDerivedKeys(true);
                } else if (DOMUtils.getFirstChildWithName(elem,
                        SP12Constants.REQUIRE_EXPLICIT_DERIVED_KEYS) != null) {
                    spnegoContextToken.setExplicitDerivedKeys(true);
                }
            } else if (consts.getNamespace().equals(qn.getNamespaceURI())
                    && SPConstants.ISSUER.equals(qn.getLocalPart())) {
                spnegoContextToken.setIssuerEpr(DOMUtils.getFirstElement(elem));
            }
            elem = DOMUtils.getNextElement(elem);
        }
       
        if (!foundPolicy && consts != SP11Constants.INSTANCE) {
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.security.policy.model.SpnegoContextToken

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.