Package org.opensaml.saml2.metadata

Examples of org.opensaml.saml2.metadata.KeyDescriptor


                }
            }
        }

        log.trace("Checking to see if any of the child entities descriptors contains the entity descriptor requested");
        EntityDescriptor entityDescriptor;
        List<EntitiesDescriptor> entitiesDescriptors = descriptor.getEntitiesDescriptors();
        if (entitiesDescriptors != null && !entitiesDescriptors.isEmpty()) {
            for (EntitiesDescriptor entitiesDescriptor : descriptor.getEntitiesDescriptors()) {
                entityDescriptor = getEntityDescriptorById(entityID, entitiesDescriptor);
                if (entityDescriptor != null) {
View Full Code Here


*/
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

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

        }
    }

    /** {@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

    }

    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

    }

    /** {@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

        }
    }

    /** {@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

        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

        if (DatatypeHelper.isEmpty(supportedProtocol)) {
            log.debug("Supported protocol was null, skipping search for role.");
            return null;
        }

        RoleDescriptor role = doGetRole(entityID, roleName, supportedProtocol);
        if (role == null) {
            log.debug("Metadata document does not contain a role of type {} supporting protocol {} for entity {}",
                    new Object[] { roleName, supportedProtocol, entityID });
            return null;
        }
View Full Code Here

                    entityID);
            return null;
        }

        Iterator<RoleDescriptor> rolesItr = roles.iterator();
        RoleDescriptor role = null;
        while (rolesItr.hasNext()) {
            role = rolesItr.next();
            if (role != null && role.isSupportedProtocol(supportedProtocol)) {
                return role;
            }
        }

        return null;
View Full Code Here

TOP

Related Classes of org.opensaml.saml2.metadata.KeyDescriptor

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.