Search in sources :

Example 1 with MetadataResolverConfiguration

use of uk.gov.ida.saml.metadata.MetadataResolverConfiguration in project verify-hub by alphagov.

the class SamlProxyApplication method run.

@Override
public void run(SamlProxyConfiguration configuration, Environment environment) {
    environment.getObjectMapper().setDateFormat(new StdDateFormat());
    IdaSamlBootstrap.bootstrap();
    for (Class klass : getResources()) {
        environment.jersey().register(klass);
    }
    for (Class klass : getExceptionMappers()) {
        environment.jersey().register(klass);
    }
    MetadataResolverConfiguration metadataConfiguration = configuration.getMetadataConfiguration();
    ClientTrustStoreConfiguration rpTrustStoreConfiguration = configuration.getRpTrustStoreConfiguration();
    KeyStore rpTrustStore = new KeyStoreLoader().load(rpTrustStoreConfiguration.getPath(), rpTrustStoreConfiguration.getPassword());
    TrustStoreMetrics trustStoreMetrics = new TrustStoreMetrics();
    metadataConfiguration.getHubTrustStore().ifPresent(hubTrustStore -> trustStoreMetrics.registerTrustStore("hub", hubTrustStore));
    metadataConfiguration.getIdpTrustStore().ifPresent(idpTrustStore -> trustStoreMetrics.registerTrustStore("idp", idpTrustStore));
    trustStoreMetrics.registerTrustStore("rp", rpTrustStore);
    environment.servlets().addFilter("Logging SessionId registration Filter", SessionIdQueryParamLoggingFilter.class).addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
}
Also used : SessionIdQueryParamLoggingFilter(uk.gov.ida.hub.samlproxy.filters.SessionIdQueryParamLoggingFilter) KeyStoreLoader(uk.gov.ida.truststore.KeyStoreLoader) TrustStoreMetrics(uk.gov.ida.common.shared.security.TrustStoreMetrics) ClientTrustStoreConfiguration(uk.gov.ida.truststore.ClientTrustStoreConfiguration) StdDateFormat(com.fasterxml.jackson.databind.util.StdDateFormat) DispatcherType(javax.servlet.DispatcherType) KeyStore(java.security.KeyStore) MetadataResolverConfiguration(uk.gov.ida.saml.metadata.MetadataResolverConfiguration)

Example 2 with MetadataResolverConfiguration

use of uk.gov.ida.saml.metadata.MetadataResolverConfiguration in project verify-hub by alphagov.

the class SamlSoapProxyApplication method run.

@Override
public void run(SamlSoapProxyConfiguration configuration, Environment environment) {
    IdaSamlBootstrap.bootstrap();
    environment.getObjectMapper().setDateFormat(new StdDateFormat());
    registerResources(environment);
    // calling .get() here is safe because the Optional is never empty
    MetadataResolverConfiguration metadataConfiguration = configuration.getMetadataConfiguration().get();
    ClientTrustStoreConfiguration rpTrustStoreConfiguration = configuration.getRpTrustStoreConfiguration();
    KeyStore rpTrustStore = new KeyStoreLoader().load(rpTrustStoreConfiguration.getPath(), rpTrustStoreConfiguration.getPassword());
    TrustStoreMetrics trustStoreMetrics = new TrustStoreMetrics();
    metadataConfiguration.getHubTrustStore().ifPresent(hubTrustStore -> trustStoreMetrics.registerTrustStore("hub", hubTrustStore));
    metadataConfiguration.getIdpTrustStore().ifPresent(idpTrustStore -> trustStoreMetrics.registerTrustStore("idp", idpTrustStore));
    trustStoreMetrics.registerTrustStore("rp", rpTrustStore);
    environment.servlets().addFilter("Logging SessionId registration Filter", SessionIdQueryParamLoggingFilter.class).addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
}
Also used : SessionIdQueryParamLoggingFilter(uk.gov.ida.hub.samlsoapproxy.filters.SessionIdQueryParamLoggingFilter) KeyStoreLoader(uk.gov.ida.truststore.KeyStoreLoader) TrustStoreMetrics(uk.gov.ida.common.shared.security.TrustStoreMetrics) ClientTrustStoreConfiguration(uk.gov.ida.truststore.ClientTrustStoreConfiguration) StdDateFormat(com.fasterxml.jackson.databind.util.StdDateFormat) DispatcherType(javax.servlet.DispatcherType) KeyStore(java.security.KeyStore) MetadataResolverConfiguration(uk.gov.ida.saml.metadata.MetadataResolverConfiguration)

Example 3 with MetadataResolverConfiguration

use of uk.gov.ida.saml.metadata.MetadataResolverConfiguration in project verify-hub by alphagov.

the class SamlEngineApplication method run.

@Override
public final void run(SamlEngineConfiguration configuration, Environment environment) {
    IdaSamlBootstrap.bootstrap();
    environment.getObjectMapper().registerModule(new GuavaModule());
    environment.getObjectMapper().setDateFormat(new StdDateFormat());
    // register resources
    registerResources(environment, configuration);
    // register exception mappers
    environment.jersey().register(SamlEngineExceptionMapper.class);
    // calling .get() here is safe because the Optional is never empty
    MetadataResolverConfiguration metadataConfiguration = configuration.getMetadataConfiguration().get();
    ClientTrustStoreConfiguration rpTrustStoreConfiguration = configuration.getRpTrustStoreConfiguration();
    KeyStore rpTrustStore = new KeyStoreLoader().load(rpTrustStoreConfiguration.getPath(), rpTrustStoreConfiguration.getPassword());
    TrustStoreMetrics trustStoreMetrics = new TrustStoreMetrics();
    metadataConfiguration.getHubTrustStore().ifPresent(hubTrustStore -> trustStoreMetrics.registerTrustStore("hub", hubTrustStore));
    metadataConfiguration.getIdpTrustStore().ifPresent(idpTrustStore -> trustStoreMetrics.registerTrustStore("idp", idpTrustStore));
    trustStoreMetrics.registerTrustStore("rp", rpTrustStore);
    environment.servlets().addFilter("Logging SessionId registration Filter", SessionIdQueryParamLoggingFilter.class).addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
}
Also used : SessionIdQueryParamLoggingFilter(uk.gov.ida.hub.samlengine.filters.SessionIdQueryParamLoggingFilter) KeyStoreLoader(uk.gov.ida.truststore.KeyStoreLoader) TrustStoreMetrics(uk.gov.ida.common.shared.security.TrustStoreMetrics) ClientTrustStoreConfiguration(uk.gov.ida.truststore.ClientTrustStoreConfiguration) StdDateFormat(com.fasterxml.jackson.databind.util.StdDateFormat) DispatcherType(javax.servlet.DispatcherType) KeyStore(java.security.KeyStore) GuavaModule(com.fasterxml.jackson.datatype.guava.GuavaModule) MetadataResolverConfiguration(uk.gov.ida.saml.metadata.MetadataResolverConfiguration)

Aggregations

StdDateFormat (com.fasterxml.jackson.databind.util.StdDateFormat)3 KeyStore (java.security.KeyStore)3 DispatcherType (javax.servlet.DispatcherType)3 TrustStoreMetrics (uk.gov.ida.common.shared.security.TrustStoreMetrics)3 MetadataResolverConfiguration (uk.gov.ida.saml.metadata.MetadataResolverConfiguration)3 ClientTrustStoreConfiguration (uk.gov.ida.truststore.ClientTrustStoreConfiguration)3 KeyStoreLoader (uk.gov.ida.truststore.KeyStoreLoader)3 GuavaModule (com.fasterxml.jackson.datatype.guava.GuavaModule)1 SessionIdQueryParamLoggingFilter (uk.gov.ida.hub.samlengine.filters.SessionIdQueryParamLoggingFilter)1 SessionIdQueryParamLoggingFilter (uk.gov.ida.hub.samlproxy.filters.SessionIdQueryParamLoggingFilter)1 SessionIdQueryParamLoggingFilter (uk.gov.ida.hub.samlsoapproxy.filters.SessionIdQueryParamLoggingFilter)1