protected KeyDescriptor getKeyDescriptor(UsageType type, KeyInfo key) { @SuppressWarnings("unchecked") SAMLObjectBuilder<KeyDescriptor> builder = (SAMLObjectBuilder<KeyDescriptor>) Configuration.getBuilderFactory() .getBuilder(KeyDescriptor.DEFAULT_ELEMENT_NAME); KeyDescriptor descriptor = builder.buildObject(); descriptor.setUse(type); descriptor.setKeyInfo(key); return descriptor; }
/** {@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()); } } super.processAttribute(samlObject, attribute); } }
/** * Creates the key descriptor element with new key info each time called. * * @return KeyDescriptor with a new KeyInfo element. * @throws MetadataException */ private KeyDescriptor createKeyDescriptor() throws MetadataException { if (log.isDebugEnabled()) { log.debug("Creating the KeyDescriptor element"); } KeyDescriptor keyDescriptor = BuilderUtil.createSAMLObject(ConfigElements.FED_METADATA_NS, "KeyDescriptor", ""); keyDescriptor.setUse(UsageType.SIGNING); keyDescriptor.setKeyInfo(createKeyInfo()); return keyDescriptor; }
protected KeyDescriptor getKeyDescriptor(UsageType type, 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; }
encKeyDescriptor.setUse(UsageType.SIGNING);
KeyDescriptor.class, KeyDescriptor.DEFAULT_ELEMENT_NAME); keyDescriptor.setKeyInfo(getKeyInfo(identity)); keyDescriptor.setUse(UsageType.SIGNING); idpssoDescriptor.getKeyDescriptors().add(keyDescriptor);