Search code examples
spring-securityspring-saml

Add custom elements to metadata generator


I'm generating metadata.xml using org.springframework.security.saml.metadata.MetadataGenerator

MetadataGenerator metadataGenerator = new MetadataGenerator(); ExtendedMetadata extendedMetadata = new ExtendedMetadata(); metadataGenerator.setExtendedMetadata(extendedMetadata);

The identity provider (idp) needs to have attributes specific to that idp. I don't see any way to add custom attributes to the metadata generator.

Is there a way to accomplish this?


Solution

  • You will need to extend the MetadataGenerator. The good candidate methods to override are buildSPSSODescriptor and buildExtensions.