Examples of KeyValueToken


Examples of com.sun.xml.ws.security.policy.KeyValueToken

            rsaTB.setUUID(token.getTokenId());                       
            setTokenInclusion(rsaTB,(Token) tokenAssertion);
            policy.setKeyBinding(rsaTB);
        }else if (PolicyUtil.isKeyValueToken((PolicyAssertion) token, spVersion)){
            AuthenticationTokenPolicy.KeyValueTokenBinding rsaTB =  new AuthenticationTokenPolicy.KeyValueTokenBinding();
            KeyValueToken rsaToken = (KeyValueToken)tokenAssertion;
            rsaTB.setUUID(token.getTokenId());  
            rsaTB.isOptional(tokenAssertion.isOptional());
            setTokenInclusion(rsaTB,(Token) tokenAssertion);
            policy.setKeyBinding(rsaTB);
        }else{
View Full Code Here

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

    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) {
            Element child = DOMUtils.getFirstElement(polEl);
            if (child != null) {
                QName qname = new QName(child.getNamespaceURI(), child.getLocalName());
                if ("RsaKeyValue".equals(qname.getLocalPart())) {
                    token.setForceRsaKeyValue(true);
                }
            }
        }
        return token;
    }
View Full Code Here

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

    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) {
            LOG.warning("sp:KeyValueToken/wsp:Policy should have a value!");
        } else {
            token.setPolicy(polEl);
            Element child = DOMUtils.getFirstElement(polEl);
            if (child != null) {
                QName qname = new QName(child.getNamespaceURI(), child.getLocalName());
                if ("RsaKeyValue".equals(qname.getLocalPart())) {
                    token.setForceRsaKeyValue(true);
                }
            }
        }

        return token;
View Full Code Here

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

    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) {
            Element child = DOMUtils.getFirstElement(polEl);
            if (child != null) {
                QName qname = new QName(child.getNamespaceURI(), child.getLocalName());
                if ("RsaKeyValue".equals(qname.getLocalPart())) {
                    token.setForceRsaKeyValue(true);
                }
            }
        }
        return token;
    }
View Full Code Here

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

    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(
                "sp:KeyValueToken/wsp:Policy must have a value"
            );
        }
       
        token.setPolicy(polEl);
        Element child = DOMUtils.getFirstElement(polEl);
        if (child != null) {
            QName qname = new QName(child.getNamespaceURI(), child.getLocalName());
            if ("RsaKeyValue".equals(qname.getLocalPart())) {
                token.setForceRsaKeyValue(true);
            }
        }
        return token;
    }
View Full Code Here

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

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

        KeyValueToken token = new KeyValueToken(consts);
        token.setOptional(PolicyConstants.isOptional(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) {
            Element child = DOMUtils.getFirstElement(polEl);
            if (child != null) {
                QName qname = new QName(child.getNamespaceURI(), child.getLocalName());
                if ("RsaKeyValue".equals(qname.getLocalPart())) {
                    token.setForceRsaKeyValue(true);
                }
            }
        }
        return token;
    }
View Full Code Here

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

    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(
                "sp:KeyValueToken/wsp:Policy must have a value"
            );
        }
        Element child = DOMUtils.getFirstElement(polEl);
        if (child != null) {
            QName qname = new QName(child.getNamespaceURI(), child.getLocalName());
            if ("RsaKeyValue".equals(qname.getLocalPart())) {
                token.setForceRsaKeyValue(true);
            }
        }
        return token;
    }
View Full Code Here

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

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

        KeyValueTokenSecurityEvent keyValueTokenSecurityEvent = (KeyValueTokenSecurityEvent) tokenSecurityEvent;
        KeyValueToken keyValueToken = (KeyValueToken) abstractToken;
        if (keyValueToken.isRsaKeyValue() && !(keyValueTokenSecurityEvent.getSecurityToken() instanceof RsaKeyValueSecurityToken)) {
            setErrorMessage("Policy enforces that a RsaKeyValue must be present in the KeyValueToken but we got a " +
                    keyValueTokenSecurityEvent.getSecurityToken().getClass().getSimpleName());
            return false;
        }
        //always return true to prevent false alarm in case additional tokens with the same usage
View Full Code Here

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

    public KeyValueTokenAssertionState(AbstractSecurityAssertion assertion, boolean asserted,
                                       PolicyAsserter policyAsserter, boolean initiator) {
        super(assertion, asserted, policyAsserter, initiator);
       
        if (asserted) {
            KeyValueToken token = (KeyValueToken) getAssertion();
            String namespace = token.getName().getNamespaceURI();
            if (token.isRsaKeyValue()) {
                getPolicyAsserter().assertPolicy(new QName(namespace, SPConstants.RSA_KEY_VALUE));
            }
        }
    }
View Full Code Here

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

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

        KeyValueTokenSecurityEvent keyValueTokenSecurityEvent = (KeyValueTokenSecurityEvent) tokenSecurityEvent;
        KeyValueToken keyValueToken = (KeyValueToken) abstractToken;
       
        String namespace = getAssertion().getName().getNamespaceURI();
        if (keyValueToken.isRsaKeyValue()) {
            if (!(keyValueTokenSecurityEvent.getSecurityToken() instanceof RsaKeyValueSecurityToken)) {
                setErrorMessage("Policy enforces that a RsaKeyValue must be present in the KeyValueToken but we got a " +
                    keyValueTokenSecurityEvent.getSecurityToken().getClass().getSimpleName());
                getPolicyAsserter().unassertPolicy(new QName(namespace, SPConstants.RSA_KEY_VALUE),
                                                   getErrorMessage());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.