Examples of UsageType


Examples of org.opensaml.xml.security.credential.UsageType

        String entityID = criteriaSet.get(EntityIDCriteria.class).getEntityID();
        MetadataCriteria mdCriteria = criteriaSet.get(MetadataCriteria.class);
        QName role = mdCriteria.getRole();
        String protocol = mdCriteria.getProtocol();
        UsageCriteria usageCriteria = criteriaSet.get(UsageCriteria.class);
        UsageType usage;
        if (usageCriteria != null) {
            usage = usageCriteria.getUsage();
        } else {
            usage = UsageType.UNSPECIFIED;
        }
View Full Code Here

Examples of org.opensaml.xml.security.credential.UsageType

    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);
View Full Code Here

Examples of org.opensaml.xml.security.credential.UsageType

    /** {@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
            } else {
                // Just in case values are unknowingly added to UsageType in the future...
               throw new MarshallingException("KeyDescriptor had illegal value for use attribute: " + use.toString());
            }
        }
    }
View Full Code Here

Examples of org.opensaml.xml.security.credential.UsageType

     *
     * @param keyDescriptor the key descriptor to validate
     * @throws ValidationException throw in use attribute does not have a legal value
     */
    protected void validateUse(KeyDescriptor keyDescriptor) throws ValidationException {
        UsageType use = keyDescriptor.getUse();
        if (use == null) {
            return;
        }
        if (       ! use.equals(UsageType.SIGNING)
                && ! use.equals(UsageType.ENCRYPTION)
                && ! use.equals(UsageType.UNSPECIFIED) ) {
            throw new ValidationException("Invalid value for use attribute: " + use.toString());
        }
    }
View Full Code Here

Examples of org.opensaml.xml.security.credential.UsageType

        String entityID = criteriaSet.get(EntityIDCriteria.class).getEntityID();
        MetadataCriteria mdCriteria = criteriaSet.get(MetadataCriteria.class);
        QName role = mdCriteria.getRole();
        String protocol = mdCriteria.getProtocol();
        UsageCriteria usageCriteria = criteriaSet.get(UsageCriteria.class);
        UsageType usage = null;
        if (usageCriteria != null) {
            usage = usageCriteria.getUsage();
        } else {
            usage = UsageType.UNSPECIFIED;
        }
View Full Code Here

Examples of org.opensaml.xml.security.credential.UsageType

            List<KeyDescriptor> keyDescriptors = roleDescriptor.getKeyDescriptors();
            if(keyDescriptors == null || keyDescriptors.isEmpty()){
                return credentials;
            }           
            for (KeyDescriptor keyDescriptor : keyDescriptors) {
                UsageType mdUsage = keyDescriptor.getUse();
                if (mdUsage == null) {
                    mdUsage = UsageType.UNSPECIFIED;
                }
                if (matchUsage(mdUsage, usage)) {
                    if (keyDescriptor.getKeyInfo() != null) {
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.