use of org.springframework.security.saml.metadata.CachingMetadataManager in project hub-alert by blackducksoftware.
the class SamlManagerTest method init.
@BeforeEach
public void init() throws Exception {
gson = new Gson();
context = Mockito.mock(SAMLContext.class);
parserPool = Mockito.mock(ParserPool.class);
extendedMetadata = Mockito.mock(ExtendedMetadata.class);
metadataManager = new CachingMetadataManager(Collections.emptyList());
metadataManager.setKeyManager(new EmptyKeyManager());
metadataGenerator = Mockito.mock(MetadataGenerator.class);
currentConfiguration = Mockito.mock(ConfigurationModel.class);
alertProperties = Mockito.mock(AlertProperties.class);
Mockito.when(alertProperties.getAlertSecretsDir()).thenReturn("./testDB/run/secrets");
filePersistenceUtil = new FilePersistenceUtil(alertProperties, gson);
}
use of org.springframework.security.saml.metadata.CachingMetadataManager in project open-kilda by telstra.
the class SecurityConfig method metadata.
@Bean
@Qualifier("metadata")
public CachingMetadataManager metadata(ExtendedMetadataDelegate extendedMetadataDelegate) throws MetadataProviderException, IOException {
List<MetadataProvider> metadataProviderList = new ArrayList<>();
List<SamlConfigEntity> samlConfigEntityList = samlRepository.findAll();
if (samlConfigEntityList != null) {
for (final SamlConfigEntity samlConfigEntity : samlConfigEntityList) {
if (samlConfigEntity.getUrl() != null) {
UrlMetadataProvider urlMetadataProvider = new UrlMetadataProvider(new Timer(true), new HttpClient(), samlConfigEntity.getUuid());
urlMetadataProvider.setParserPool(ParserPoolHolder.getPool());
ExtendedMetadataDelegate metadataDelegate = new ExtendedMetadataDelegate(urlMetadataProvider, extendedMetadata());
metadataDelegate.setMetadataTrustCheck(false);
metadataDelegate.setMetadataRequireSignature(false);
metadataProviderList.add(metadataDelegate);
} else {
DbMetadataProvider metadataProvider = new DbMetadataProvider(new Timer(true), samlConfigEntity.getUuid());
metadataProvider.setParserPool(ParserPoolHolder.getPool());
ExtendedMetadataDelegate metadataDelegate = new ExtendedMetadataDelegate(metadataProvider, extendedMetadata());
metadataDelegate.setMetadataTrustCheck(false);
metadataDelegate.setMetadataRequireSignature(false);
metadataProviderList.add(metadataDelegate);
}
}
}
return new CachingMetadataManager(metadataProviderList);
}
Aggregations