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

Examples of org.apache.cxf.ws.security.policy.SPConstants


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

        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
            ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;

        SecurityContextToken contextToken = new SecurityContextToken(consts);

        String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken());

        if (includeAttr != null) {
            contextToken.setInclusion(consts.getInclusionFromAttributeValue(includeAttr));
        }

        Element policyElement = PolicyConstants.findPolicyElement(element);
        if (policyElement == null && consts != SP11Constants.INSTANCE) {
            throw new IllegalArgumentException(
                "sp:SecurityContextToken/wsp:Policy must have a value"
            );
        }

        if (policyElement != null) {
            contextToken.setPolicy(policyElement);
            if (DOMUtils.getFirstChildWithName(policyElement,
                    consts.getNamespace(),
                    SPConstants.REQUIRE_DERIVED_KEYS) != null) {
                contextToken.setDerivedKeys(true);
            }
   
            if (DOMUtils.getFirstChildWithName(policyElement,
                    consts.getNamespace(),
                    SPConstants.REQUIRE_EXTERNAL_URI_REFERENCE) != null) {
                contextToken.setRequireExternalUriRef(true);
            }
   
            if (DOMUtils.getFirstChildWithName(policyElement,
                    consts.getNamespace(),
                    SPConstants.SC10_SECURITY_CONTEXT_TOKEN) != null) {
                contextToken.setSc10SecurityContextToken(true);
            }
   
            if (DOMUtils.getFirstChildWithName(policyElement,
                    consts.getNamespace(),
                    SPConstants.SC13_SECURITY_CONTEXT_TOKEN) != null) {
                contextToken.setSc13SecurityContextToken(true);
            }
        }
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;

        SignedEncryptedParts signedEncryptedParts = new SignedEncryptedParts(true, consts);

View Full Code Here

        return new QName[]{SP11Constants.SPNEGO_CONTEXT_TOKEN, SP12Constants.SPNEGO_CONTEXT_TOKEN};
    }
   
    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);
        }
View Full Code Here

        builder = b;
    }
   
    public Assertion build(Element element, AssertionBuilderFactory factory) {
       
        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
            ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;

        KerberosToken kerberosToken = new KerberosToken(consts);
        kerberosToken.setOptional(PolicyConstants.isOptional(element));
        kerberosToken.setIgnorable(PolicyConstants.isIgnorable(element));

        String attribute = element.getAttributeNS(element.getNamespaceURI(), SPConstants.ATTR_INCLUDE_TOKEN);
        if (attribute != null) {
            kerberosToken.setInclusion(consts.getInclusionFromAttributeValue(attribute.trim()));
        }
       
        Element child = DOMUtils.getFirstElement(element);
        boolean foundPolicy = false;
        while (child != null) {
View Full Code Here

        builder = b;
    }
   
    public Assertion build(Element element, AssertionBuilderFactory factory) {
       
        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
            ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;

        SamlToken samlToken = new SamlToken(consts);
        samlToken.setOptional(PolicyConstants.isOptional(element));
        samlToken.setIgnorable(PolicyConstants.isIgnorable(element));

        String attribute = element.getAttributeNS(element.getNamespaceURI(), SPConstants.ATTR_INCLUDE_TOKEN);
        if (attribute != null) {
            samlToken.setInclusion(consts.getInclusionFromAttributeValue(attribute));
        }
       
        Element child = DOMUtils.getFirstElement(element);
        boolean foundPolicy = false;
        while (child != null) {
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;
       
       
        SecureConversationToken conversationToken = new SecureConversationToken(consts);
        conversationToken.setOptional(PolicyConstants.isOptional(element));
        conversationToken.setIgnorable(PolicyConstants.isIgnorable(element));

        String attribute = DOMUtils.getAttribute(element, consts.getIncludeToken());
        if (attribute != null) {
            conversationToken.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;
                conversationToken.setPolicy(elem);
                if (DOMUtils.getFirstChildWithName(elem,
                                                   consts.getNamespace(),
                                                   SPConstants.REQUIRE_DERIVED_KEYS) != null) {
                    conversationToken.setDerivedKeys(true);
                } else if (DOMUtils.getFirstChildWithName(elem,
                                                          SP12Constants
                                                              .REQUIRE_IMPLIED_DERIVED_KEYS)
                                                          != null) {
                    conversationToken.setImpliedDerivedKeys(true);
                } else if (DOMUtils.getFirstChildWithName(elem,
                                                          SP12Constants
                                                              .REQUIRE_EXPLICIT_DERIVED_KEYS)
                                                              != null) {
                    conversationToken.setExplicitDerivedKeys(true);
                }


                if (DOMUtils.getFirstChildWithName(elem,
                                                   consts.getNamespace(),
                                                   SPConstants.REQUIRE_EXTERNAL_URI_REFERENCE) != null) {
                    conversationToken.setRequireExternalUriRef(true);
                }

                if (DOMUtils.getFirstChildWithName(elem,
                                                   consts.getNamespace(),
                                                   SPConstants.SC10_SECURITY_CONTEXT_TOKEN) != null) {
                    conversationToken.setSc10SecurityContextToken(true);
                }
               
                if (DOMUtils.getFirstChildWithName(elem,
                        consts.getNamespace(),
                        SPConstants.SC13_SECURITY_CONTEXT_TOKEN) != null) {
                    conversationToken.setSc13SecurityContextToken(true);
                }

                Element bootstrapPolicyElement = DOMUtils.getFirstChildWithName(elem,
                                                                                consts.getNamespace(),
                                                                                SPConstants.BOOTSTRAP_POLICY);
                if (bootstrapPolicyElement != null) {
                    Policy policy = builder.getPolicy(DOMUtils.getFirstElement(bootstrapPolicyElement));
                    conversationToken.setBootstrapPolicy(policy);
                }

            } else if (consts.getNamespace().equals(qn.getNamespaceURI())
                && SPConstants.ISSUER.equals(qn.getLocalPart())) {
                conversationToken.setIssuerEpr(DOMUtils.getFirstElement(elem));               
            }
            elem = DOMUtils.getNextElement(elem);
        }
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;
   

        IssuedToken issuedToken = new IssuedToken(consts);
        issuedToken.setOptional(PolicyConstants.isOptional(element));
        issuedToken.setIgnorable(PolicyConstants.isIgnorable(element));

        String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken());
        if (includeAttr != null) {
            issuedToken.setInclusion(consts.getInclusionFromAttributeValue(includeAttr));
        }
       
        Element child = DOMUtils.getFirstElement(element);
        boolean foundPolicy = false;
        boolean foundRST = false;
View Full Code Here

   
    /**
     * {@inheritDoc}
     */
    public Assertion build(Element element, AssertionBuilderFactory factory) {
        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
            ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;

       
        HttpsToken httpsToken = new HttpsToken(consts);
        httpsToken.setOptional(PolicyConstants.isOptional(element));
        httpsToken.setIgnorable(PolicyConstants.isIgnorable(element));

        if (consts.getVersion() == SPConstants.Version.SP_V11) {
            String attr = DOMUtils.getAttribute(element, SPConstants.REQUIRE_CLIENT_CERTIFICATE);
            if (attr != null) {
                httpsToken.setRequireClientCertificate("true".equals(attr));
            }
        } else {
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;

        SignedEncryptedParts signedEncryptedParts = new SignedEncryptedParts(false, consts);

        Node nd = element.getFirstChild();
View Full Code Here

    public KeyValueTokenBuilder() {
    }
   
    public Assertion build(Element element, AssertionBuilderFactory factory) {
       
        SPConstants consts = MS_NS.equals(element.getNamespaceURI())
            ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;

        KeyValueToken token = new KeyValueToken(consts);
        token.setOptional(PolicyConstants.isOptional(element));
        token.setIgnorable(PolicyConstants.isIgnorable(element));
       
        String attribute = element.getAttributeNS(element.getNamespaceURI(), SPConstants.ATTR_INCLUDE_TOKEN);
        if (StringUtils.isEmpty(attribute)) {
            attribute = element.getAttributeNS(consts.getNamespace(), SPConstants.ATTR_INCLUDE_TOKEN);
        }
        if (StringUtils.isEmpty(attribute)) {
            attribute = element.getAttributeNS(SP11Constants.INSTANCE.getNamespace(),
                                               SPConstants.ATTR_INCLUDE_TOKEN);
        }
        if (!StringUtils.isEmpty(attribute)) {
            token.setInclusion(consts.getInclusionFromAttributeValue(attribute));
        }

        Element polEl = PolicyConstants.findPolicyElement(element);
        if (polEl == null) {
            throw new IllegalArgumentException(
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.security.policy.SPConstants

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.