Examples of KeyDescriptor


Examples of org.opensaml.saml2.metadata.KeyDescriptor

*/
public class KeyDescriptorMarshaller extends AbstractSAMLObjectMarshaller {

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
        KeyDescriptor keyDescriptor = (KeyDescriptor) xmlObject;

        if (keyDescriptor.getUse() != null) {
            UsageType use = keyDescriptor.getUse();
            // UsageType enum contains more values than are allowed by SAML 2 schema
            if (use.equals(UsageType.SIGNING) || use.equals(UsageType.ENCRYPTION)) {
                domElement.setAttribute(KeyDescriptor.USE_ATTRIB_NAME, use.toString().toLowerCase());
            } else if (use.equals(UsageType.UNSPECIFIED)) {
                // emit nothing for unspecified - this is semantically equivalent to non-existent attribute
View Full Code Here

Examples of org.opensaml.saml2.metadata.KeyDescriptor

public class KeyDescriptorUnmarshaller extends AbstractSAMLObjectUnmarshaller {

    /** {@inheritDoc} */
    protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
            throws UnmarshallingException {
        KeyDescriptor keyDescriptor = (KeyDescriptor) parentSAMLObject;

        if (childSAMLObject instanceof KeyInfo) {
            keyDescriptor.setKeyInfo((KeyInfo) childSAMLObject);
        } else if (childSAMLObject instanceof EncryptionMethod) {
            keyDescriptor.getEncryptionMethods().add((EncryptionMethod) childSAMLObject);
        } else {
            super.processChildElement(parentSAMLObject, childSAMLObject);
        }
    }
View Full Code Here

Examples of org.opensaml.saml2.metadata.KeyDescriptor

        }
    }

    /** {@inheritDoc} */
    protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
        KeyDescriptor keyDescriptor = (KeyDescriptor) samlObject;

        if (attribute.getName().equals(KeyDescriptor.USE_ATTRIB_NAME)) {
            try {
                UsageType usageType = UsageType.valueOf(UsageType.class, attribute.getValue().toUpperCase());
                // Only allow the enum values specified in the schema.
                if (usageType != UsageType.SIGNING && usageType != UsageType.ENCRYPTION) {
                    throw new UnmarshallingException("Invalid key usage type: " + attribute.getValue());
                }
                keyDescriptor.setUse(usageType);
            } catch (IllegalArgumentException e) {
                throw new UnmarshallingException("Invalid key usage type: " + attribute.getValue());
            }
        }

View Full Code Here

Examples of org.opensaml.saml2.metadata.KeyDescriptor

    }

    protected KeyDescriptor getKeyDescriptor(final UsageType type, final KeyInfo key) {
        SAMLObjectBuilder<KeyDescriptor> builder = (SAMLObjectBuilder<KeyDescriptor>) Configuration.getBuilderFactory()
                .getBuilder(KeyDescriptor.DEFAULT_ELEMENT_NAME);
        KeyDescriptor descriptor = builder.buildObject();
        descriptor.setUse(type);
        descriptor.setKeyInfo(key);
        return descriptor;
    }
View Full Code Here

Examples of org.opensaml.saml2.metadata.KeyDescriptor

    }

    /** {@inheritDoc} */
    protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
            throws UnmarshallingException {
        KeyDescriptor keyDescriptor = (KeyDescriptor) parentSAMLObject;

        if (childSAMLObject instanceof KeyInfo) {
            keyDescriptor.setKeyInfo((KeyInfo) childSAMLObject);
        } else if (childSAMLObject instanceof EncryptionMethod) {
            keyDescriptor.getEncryptionMethods().add((EncryptionMethod) childSAMLObject);
        } else {
            super.processChildElement(parentSAMLObject, childSAMLObject);
        }
    }
View Full Code Here

Examples of org.opensaml.saml2.metadata.KeyDescriptor

        }
    }

    /** {@inheritDoc} */
    protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
        KeyDescriptor keyDescriptor = (KeyDescriptor) samlObject;

        if (attribute.getName().equals(KeyDescriptor.USE_ATTRIB_NAME)) {
            try {
                UsageType usageType =  UsageType.valueOf(UsageType.class, attribute.getValue().toUpperCase());
                // Only allow the enum values specified in the schema.
                if (usageType != UsageType.SIGNING && usageType != UsageType.ENCRYPTION) {
                    throw new UnmarshallingException("Invalid key usage type: " + attribute.getValue());
                }
                keyDescriptor.setUse(usageType);
            } catch (IllegalArgumentException e) {
                throw new UnmarshallingException("Invalid key usage type: " + attribute.getValue());
            }
        }

View Full Code Here

Examples of org.opensaml.saml2.metadata.KeyDescriptor

        super(namespaceURI, elementLocalName);
    }

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
        KeyDescriptor keyDescriptor = (KeyDescriptor) xmlObject;

        if (keyDescriptor.getUse() != null) {
            UsageType use = keyDescriptor.getUse();
            // UsageType enum contains more values than are allowed by SAML 2 schema
            if (use.equals(UsageType.SIGNING) || use.equals(UsageType.ENCRYPTION)) {
                domElement.setAttribute(KeyDescriptor.USE_ATTRIB_NAME, use.toString().toLowerCase());
            } else if (use.equals(UsageType.UNSPECIFIED)) {
                //emit nothing for unspecified - this is semantically equivalent to non-existent attribute
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.