ExtendedMetadataConfigurer extends SecurityConfigurerAdapter<Void, ServiceProviderBuilder> { @Override public void configure(ServiceProviderBuilder builder) throws Exception { if (extendedMetadataBean == null) { if (extendedMetadata == null) { extendedMetadata = createExtendedMetadata(); extendedMetadata.setIdpDiscoveryEnabled(Optional.ofNullable(idpDiscoveryEnabled).orElseGet(extendedMetadataConfig::isIdpDiscoveryEnabled)); extendedMetadata.setEcpEnabled(Optional.ofNullable(ecpEnabled).orElseGet(extendedMetadataConfig::isEcpEnabled)); extendedMetadata.setSignMetadata(Optional.ofNullable(signMetadata).orElseGet(extendedMetadataConfig::isSignMetadata)); extendedMetadata.setRequireLogoutRequestSigned(Optional.ofNullable(requireLogoutRequestSigned).orElseGet(extendedMetadataConfig::isRequireLogoutRequestSigned)); extendedMetadata.setRequireLogoutResponseSigned(Optional.ofNullable(requireLogoutResponseSigned).orElseGet(extendedMetadataConfig::isRequireLogoutResponseSigned)); extendedMetadata.setRequireArtifactResolveSigned(Optional.ofNullable(requireArtifactResolveSigned).orElseGet(extendedMetadataConfig::isRequireArtifactResolveSigned)); extendedMetadata.setSupportUnsolicitedResponse(Optional.ofNullable(supportUnsolicitedResponse).orElseGet(extendedMetadataConfig::isSupportUnsolicitedResponse)); extendedMetadata.setAlias(Optional.ofNullable(alias).orElseGet(extendedMetadataConfig::getAlias)); extendedMetadata.setIdpDiscoveryURL(Optional.ofNullable(idpDiscoveryURL).orElseGet(extendedMetadataConfig::getIdpDiscoveryUrl)); extendedMetadata.setIdpDiscoveryResponseURL(Optional.ofNullable(idpDiscoveryResponseURL).orElseGet(extendedMetadataConfig::getIdpDiscoveryResponseUrl)); extendedMetadata.setSecurityProfile(Optional.ofNullable(securityProfile).orElseGet(extendedMetadataConfig::getSecurityProfile)); extendedMetadata.setSslSecurityProfile(Optional.ofNullable(sslSecurityProfile).orElseGet(extendedMetadataConfig::getSslSecurityProfile)); extendedMetadata.setSslHostnameVerification(Optional.ofNullable(sslHostnameVerification).orElseGet(extendedMetadataConfig::getSslHostnameVerification)); extendedMetadata.setSigningKey(Optional.ofNullable(signingKey).orElseGet(extendedMetadataConfig::getSigningKey)); extendedMetadata.setSigningAlgorithm(Optional.ofNullable(signingAlgorithm).orElseGet(extendedMetadataConfig::getSigningAlgorithm)); extendedMetadata.setKeyInfoGeneratorName(Optional.ofNullable(keyInfoGeneratorName).orElseGet(extendedMetadataConfig::getKeyInfoGeneratorName)); extendedMetadata.setEncryptionKey(Optional.ofNullable(encryptionKey).orElseGet(extendedMetadataConfig::getEncryptionKey)); extendedMetadata.setTlsKey(Optional.ofNullable(tlsKey).orElseGet(extendedMetadataConfig::getTlsKey)); extendedMetadata.setTrustedKeys(Optional.ofNullable(trustedKeys).orElseGet(extendedMetadataConfig::getTrustedKeys)); } shareExtendedMetadata(builder); } } ExtendedMetadataConfigurer();  ExtendedMetadataConfigurer(ExtendedMetadata extendedMetadata); @Override void init(ServiceProviderBuilder builder); @Override void configure(ServiceProviderBuilder builder); @Deprecated ExtendedMetadataConfigurer local(Boolean local); ExtendedMetadataConfigurer idpDiscoveryEnabled(boolean idpDiscoveryEnabled); ExtendedMetadataConfigurer ecpEnabled(boolean ecpEnabled); ExtendedMetadataConfigurer signMetadata(boolean signMetadata); ExtendedMetadataConfigurer requireLogoutRequestSigned(boolean requireLogoutRequestSigned); ExtendedMetadataConfigurer requireLogoutResponseSigned(boolean requireLogoutResponseSigned); ExtendedMetadataConfigurer requireArtifactResolveSigned(boolean requireArtifactResolveSigned); ExtendedMetadataConfigurer supportUnsolicitedResponse(boolean supportUnsolicitedResponse); ExtendedMetadataConfigurer alias(String alias); ExtendedMetadataConfigurer idpDiscoveryURL(String idpDiscoveryURL); ExtendedMetadataConfigurer idpDiscoveryResponseURL(String idpDiscoveryResponseURL); ExtendedMetadataConfigurer securityProfile(String securityProfile); ExtendedMetadataConfigurer sslSecurityProfile(String sslSecurityProfile); ExtendedMetadataConfigurer sslHostnameVerification(String sslHostnameVerification); ExtendedMetadataConfigurer signingKey(String signingKey); ExtendedMetadataConfigurer signingAlgorithm(String signingAlgorithm); ExtendedMetadataConfigurer keyInfoGeneratorName(String keyInfoGeneratorName); ExtendedMetadataConfigurer encryptionKey(String encryptionKey); ExtendedMetadataConfigurer tlsKey(String tlsKey); ExtendedMetadataConfigurer trustedKeys(String... trustedKeys);  }
@Test public void configure() throws Exception { ExtendedMetadataConfigurer configurer = new ExtendedMetadataConfigurer(); configurer.init(builder); configurer.configure(builder); verify(builder).setSharedObject(eq(ExtendedMetadata.class), any(ExtendedMetadata.class)); }