@ SneakyThrows private String buildMetadataGeneratorParameters ( final Pair < String , String > signing , final Pair < String , String > encryption ) { val template = samlIdPMetadataGeneratorConfigurationContext . getResourceLoader ( ) . getResource ( "classpath:/template-idp-metadata.xml" ) ; var signingCert = signing . getKey ( ) ; signingCert = StringUtils . remove ( signingCert , BEGIN_CERTIFICATE ) ; signingCert = StringUtils . remove ( signingCert , END_CERTIFICATE ) . trim ( ) ; var encryptionCert = encryption . getKey ( ) ; encryptionCert = StringUtils . remove ( encryptionCert , BEGIN_CERTIFICATE ) ; encryptionCert = StringUtils . remove ( encryptionCert , END_CERTIFICATE ) . trim ( ) ; try ( val writer = new StringWriter ( ) ) { IOUtils . copy ( template . getInputStream ( ) , writer , StandardCharsets . UTF_8 ) ; val metadata = writer . toString ( ) . replace ( "${entityId}" , samlIdPMetadataGeneratorConfigurationContext . getEntityId ( ) ) . replace ( "${scope}" , samlIdPMetadataGeneratorConfigurationContext . getScope ( ) ) . replace ( "${idpEndpointUrl}" , getIdPEndpointUrl ( ) ) . replace ( "${encryptionKey}" , encryptionCert ) . replace ( "${signingKey}" , signingCert ) ; writeMetadata ( metadata ) ; return metadata ; } }
Build metadata generator parameters by passing the encryption signing and back - channel certs to the parameter generator .