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;
        X509Token x509Token = new X509Token(consts);
        x509Token.setOptional(PolicyConstants.isOptional(element));
        x509Token.setIgnorable(PolicyConstants.isIgnorable(element));

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

        // Process token inclusion
        String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken());

        if (includeAttr != null) {
            SPConstants.IncludeTokenType inclusion
                = consts.getInclusionFromAttributeValue(includeAttr);
            x509Token.setInclusion(inclusion);
        }

        if (policyElement != null) {
            x509Token.setPolicy(policyElement);
            if (DOMUtils.getFirstChildWithName(policyElement, consts.getRequiredDerivedKeys()) != null) {
                x509Token.setDerivedKeys(true);
            } else if (DOMUtils.getFirstChildWithName(policyElement,
                    SP12Constants.REQUIRE_IMPLIED_DERIVED_KEYS) != null) {
                x509Token.setImpliedDerivedKeys(true);
            } else if (DOMUtils.getFirstChildWithName(policyElement,
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;

        UsernameToken usernameToken = new UsernameToken(consts);
        usernameToken.setOptional(PolicyConstants.isOptional(element));
        usernameToken.setIgnorable(PolicyConstants.isIgnorable(element));

        String attribute = element.getAttributeNS(element.getNamespaceURI(), SPConstants.ATTR_INCLUDE_TOKEN);
        if (attribute != null) {
            usernameToken.setInclusion(consts.getInclusionFromAttributeValue(attribute));
        }

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

    }
   
    public PolicyAssertion build(Element element)
        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 = DOMUtils.getFirstChildWithName(element, SPConstants.POLICY);

        if (element != null) {

            if (DOMUtils.getFirstChildWithName(element,
                                               consts.getNamespace(),
                                               SPConstants.REQUIRE_DERIVED_KEYS) != null) {
                contextToken.setDerivedKeys(true);
            }

            if (DOMUtils.getFirstChildWithName(element,
                                               consts.getNamespace(),
                                               SPConstants.REQUIRE_EXTERNAL_URI_REFERNCE) != null) {
                contextToken.setRequireExternalUriRef(true);
            }

            if (DOMUtils.getFirstChildWithName(element,
                                               consts.getNamespace(),
                                               SPConstants.SC10_SECURITY_CONTEXT_TOKEN) != null) {
                contextToken.setSc10SecurityContextToken(true);
            }
        }
View Full Code Here

   

    public PolicyAssertion build(Element element)
        throws IllegalArgumentException {
       
        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
            ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
   

        IssuedToken issuedToken = new IssuedToken(consts);

        String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken());
        if (includeAttr != null) {
            issuedToken.setInclusion(consts.getInclusionFromAttributeValue(includeAttr));
        }
        // Extract Issuer
        Element issuerElem = DOMUtils.getFirstChildWithName(element, SP11Constants.ISSUER);
        if (issuerElem != null) {
            Element issuerEpr = DOMUtils
View Full Code Here

    }

    public PolicyAssertion build(Element element)
        throws IllegalArgumentException {
       
        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
            ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
        X509Token x509Token = new X509Token(consts);

        Element policyElement = DOMUtils.getFirstElement(element);

        // Process token inclusion
        String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken());

        if (includeAttr != null) {
            SPConstants.IncludeTokenType inclusion
                = consts.getInclusionFromAttributeValue(includeAttr);
            x509Token.setInclusion(inclusion);
        }

        if (policyElement != null) {

            if (DOMUtils.getFirstChildWithName(policyElement, consts.getRequiredDerivedKeys()) != null) {
                x509Token.setDerivedKeys(true);
            } else if (DOMUtils.getFirstChildWithName(policyElement,
                                                      SP12Constants.REQUIRE_IMPLIED_DERIVED_KEYS) != null) {
                x509Token.setImpliedDerivedKeys(true);
            } else if (DOMUtils.getFirstChildWithName(policyElement,
View Full Code Here

    }

    public PolicyAssertion build(Element element)
        throws IllegalArgumentException {

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

        String attribute = DOMUtils.getAttribute(element, consts.getIncludeToken());
        if (attribute == null) {
            throw new IllegalArgumentException("SecurityContextToken doesn't contain "
                                               + "any sp:IncludeToken attribute");
        }

        String inclusionValue = attribute.trim();

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

        Element issuer = DOMUtils.getFirstChildWithName(element, consts.getNamespace(), SPConstants.ISSUER);
        if (issuer != null) {
            conversationToken.setIssuerEpr(DOMUtils.getFirstElement(issuer));
        }

        element = DOMUtils.getFirstChildWithName(element, SPConstants.POLICY);
        if (element != null) {
            if (DOMUtils.getFirstChildWithName(element,
                                               consts.getNamespace(),
                                               SPConstants.REQUIRE_DERIVED_KEYS) != null) {
                conversationToken.setDerivedKeys(true);
            } else if (DOMUtils.getFirstChildWithName(element,
                                                      SP12Constants.REQUIRE_IMPLIED_DERIVED_KEYS) != null) {
                conversationToken.setImpliedDerivedKeys(true);
            } else if (DOMUtils.getFirstChildWithName(element,
                                                      SP12Constants.REQUIRE_EXPLICIT_DERIVED_KEYS) != null) {
                conversationToken.setExplicitDerivedKeys(true);
            }


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

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

            Element bootstrapPolicyElement = DOMUtils.getFirstChildWithName(element,
                                                                            consts.getNamespace(),
                                                                            SPConstants.BOOTSTRAP_POLICY);
            if (bootstrapPolicyElement != null) {
                Policy policy = builder.getPolicy(DOMUtils.getFirstElement(bootstrapPolicyElement));
                conversationToken.setBootstrapPolicy(policy);
            }
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;
   

        RecipientToken recipientToken = new RecipientToken(consts, builder);
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;

        InitiatorEncryptionToken initiatorToken = new InitiatorEncryptionToken(consts, builder);
        initiatorToken.setOptional(PolicyConstants.isOptional(element));
        initiatorToken.setIgnorable(PolicyConstants.isIgnorable(element));
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;

       
        TransportToken transportToken = new TransportToken(consts, builder);
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.