Package org.apache.ws.secpolicy.model

Examples of org.apache.ws.secpolicy.model.SecurityContextToken


public class SecurityContextTokenBuilder implements AssertionBuilder {

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

        SecurityContextToken contextToken = new SecurityContextToken();

        OMAttribute attribute = element.getAttribute(Constants.INCLUDE_TOKEN);
        if (attribute == null) {
            throw new IllegalArgumentException(
                    "SecurityContextToken doesn't contain any sp:IncludeToken attribute");
        }
       
        String inclusionValue = attribute.getAttributeValue().trim();
       
        if (inclusionValue.endsWith(Constants.INCLUDE_NEVER)) {
            contextToken.setInclusion(Constants.INCLUDE_NEVER);

        } else if (inclusionValue.endsWith(Constants.INCLUDE_ONCE)) {
            contextToken.setInclusion(Constants.INCLUDE_ONCE);

        } else if (inclusionValue
                .endsWith(Constants.INCLUDE_ALWAYS_TO_RECIPIENT)) {
            contextToken.setInclusion(Constants.INCLUDE_ALWAYS_TO_RECIPIENT);

        } else if (inclusionValue.endsWith(Constants.INCLUDE_ALWAYS)) {
            contextToken.setInclusion(Constants.INCLUDE_ALWAYS);
        }

        element = element.getFirstChildWithName(Constants.POLICY);

        if (element != null) {

            if (element.getFirstChildWithName(Constants.REQUIRE_DERIVED_KEYS) != null) {
                contextToken.setDerivedKeys(true);
            }

            if (element
                    .getFirstChildWithName(Constants.REQUIRE_EXTERNAL_URI_REFERNCE) != null) {
                contextToken.setRequireExternalUriRef(true);
            }

            if (element
                    .getFirstChildWithName(Constants.SC10_SECURITY_CONTEXT_TOKEN) != null) {
                contextToken.setSc10SecurityContextToken(true);
            }
        }

        return contextToken;
    }
View Full Code Here


public class SecurityContextTokenBuilder implements AssertionBuilder<OMElement> {

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

        SecurityContextToken contextToken = new SecurityContextToken(SPConstants.SP_V12);

        OMAttribute  includeAttr = element.getAttribute(SP12Constants.INCLUDE_TOKEN);
        if(includeAttr != null) {
            int inclusion = SP12Constants.getInclusionFromAttributeValue(includeAttr.getAttributeValue());
            contextToken.setInclusion(inclusion);
        }

        element = element.getFirstChildWithName(SPConstants.POLICY);

        if (element != null) {

            if (element.getFirstChildWithName(SP12Constants.REQUIRE_DERIVED_KEYS) != null) {
                contextToken.setDerivedKeys(true);
            }

            if (element
                    .getFirstChildWithName(SP12Constants.REQUIRE_EXTERNAL_URI_REFERNCE) != null) {
                contextToken.setRequireExternalUriRef(true);
            }

            if (element
                    .getFirstChildWithName(SP12Constants.SC10_SECURITY_CONTEXT_TOKEN) != null) {
                contextToken.setSc10SecurityContextToken(true);
            }
        }

        return contextToken;
    }
View Full Code Here

public class SecurityContextTokenBuilder implements AssertionBuilder<OMElement> {

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

        SecurityContextToken contextToken = new SecurityContextToken(SPConstants.SP_V11);

        OMAttribute  includeAttr = element.getAttribute(SP11Constants.INCLUDE_TOKEN);
       
        if(includeAttr != null) {
            int inclusion = SP11Constants.getInclusionFromAttributeValue(includeAttr.getAttributeValue());
            contextToken.setInclusion(inclusion);
        }

        element = element.getFirstChildWithName(SPConstants.POLICY);

        if (element != null) {

            if (element.getFirstChildWithName(SP11Constants.REQUIRE_DERIVED_KEYS) != null) {
                contextToken.setDerivedKeys(true);
            }

            if (element
                    .getFirstChildWithName(SP11Constants.REQUIRE_EXTERNAL_URI_REFERNCE) != null) {
                contextToken.setRequireExternalUriRef(true);
            }

            if (element
                    .getFirstChildWithName(SP11Constants.SC10_SECURITY_CONTEXT_TOKEN) != null) {
                contextToken.setSc10SecurityContextToken(true);
            }
        }

        return contextToken;
    }
View Full Code Here

public class SecurityContextTokenBuilder implements AssertionBuilder {

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

        SecurityContextToken contextToken = new SecurityContextToken(SPConstants.SP_V11);

        OMAttribute  includeAttr = element.getAttribute(SP11Constants.INCLUDE_TOKEN);
       
        if(includeAttr != null) {
            int inclusion = SP11Constants.getInclusionFromAttributeValue(includeAttr.getAttributeValue());
            contextToken.setInclusion(inclusion);
        }

        element = element.getFirstChildWithName(SPConstants.POLICY);

        if (element != null) {

            if (element.getFirstChildWithName(SP11Constants.REQUIRE_DERIVED_KEYS) != null) {
                contextToken.setDerivedKeys(true);
            }

            if (element
                    .getFirstChildWithName(SP11Constants.REQUIRE_EXTERNAL_URI_REFERNCE) != null) {
                contextToken.setRequireExternalUriRef(true);
            }

            if (element
                    .getFirstChildWithName(SP11Constants.SC10_SECURITY_CONTEXT_TOKEN) != null) {
                contextToken.setSc10SecurityContextToken(true);
            }
        }

        return contextToken;
    }
View Full Code Here

public class SecurityContextTokenBuilder implements AssertionBuilder {

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

        SecurityContextToken contextToken = new SecurityContextToken(SPConstants.SP_V12);

        OMAttribute  includeAttr = element.getAttribute(SP12Constants.INCLUDE_TOKEN);
        if(includeAttr != null) {
            int inclusion = SP12Constants.getInclusionFromAttributeValue(includeAttr.getAttributeValue());
            contextToken.setInclusion(inclusion);
        }

        element = element.getFirstChildWithName(SPConstants.POLICY);

        if (element != null) {

            if (element.getFirstChildWithName(SP12Constants.REQUIRE_DERIVED_KEYS) != null) {
                contextToken.setDerivedKeys(true);
            }

            if (element
                    .getFirstChildWithName(SP12Constants.REQUIRE_EXTERNAL_URI_REFERNCE) != null) {
                contextToken.setRequireExternalUriRef(true);
            }

            if (element
                    .getFirstChildWithName(SP12Constants.SC10_SECURITY_CONTEXT_TOKEN) != null) {
                contextToken.setSc10SecurityContextToken(true);
            }
        }

        return contextToken;
    }
View Full Code Here

public class SecurityContextTokenBuilder implements AssertionBuilder {

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

        SecurityContextToken contextToken = new SecurityContextToken();

        OMAttribute attribute = element.getAttribute(Constants.INCLUDE_TOKEN);

        OMAttribute  includeAttr = element.getAttribute(Constants.INCLUDE_TOKEN);
        if(includeAttr != null) {
            contextToken.setInclusion(includeAttr.getAttributeValue());
        }

        element = element.getFirstChildWithName(Constants.POLICY);

        if (element != null) {

            if (element.getFirstChildWithName(Constants.REQUIRE_DERIVED_KEYS) != null) {
                contextToken.setDerivedKeys(true);
            }

            if (element
                    .getFirstChildWithName(Constants.REQUIRE_EXTERNAL_URI_REFERNCE) != null) {
                contextToken.setRequireExternalUriRef(true);
            }

            if (element
                    .getFirstChildWithName(Constants.SC10_SECURITY_CONTEXT_TOKEN) != null) {
                contextToken.setSc10SecurityContextToken(true);
            }
        }

        return contextToken;
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.secpolicy.model.SecurityContextToken

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.