use of uk.gov.ida.truststore.KeyStoreLoader 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, "/*");
}
use of uk.gov.ida.truststore.KeyStoreLoader in project verify-hub by alphagov.
the class ConfigApplication method registerMetrics.
private void registerMetrics(TrustStoreMetrics metrics, String trustStoreName, ClientTrustStoreConfiguration trustStoreConfiguration) {
KeyStore trustStore = new KeyStoreLoader().load(trustStoreConfiguration.getPath(), trustStoreConfiguration.getPassword());
metrics.registerTrustStore(trustStoreName, trustStore);
}
use of uk.gov.ida.truststore.KeyStoreLoader in project verify-hub by alphagov.
the class PolicyModule method configure.
@Override
protected void configure() {
bind(RestfulClientConfiguration.class).to(PolicyConfiguration.class).in(Scopes.SINGLETON);
bind(AssertionLifetimeConfiguration.class).to(PolicyConfiguration.class).in(Scopes.SINGLETON);
bind(Client.class).toProvider(DefaultClientProvider.class).in(Scopes.SINGLETON);
bind(KeyStore.class).toProvider(KeyStoreProvider.class).in(Scopes.SINGLETON);
bind(KeyStoreLoader.class).toInstance(new KeyStoreLoader());
bind(SessionStoreStartupTasks.class).asEagerSingleton();
bind(JsonResponseProcessor.class);
bind(HubEventLogger.class);
bind(SessionService.class);
bind(AuthnRequestFromTransactionHandler.class);
bind(SessionRepository.class);
bind(StateControllerFactory.class);
bind(SamlEngineProxy.class);
bind(TransactionsConfigProxy.class);
bind(IdentityProvidersConfigProxy.class);
bind(AuthnResponseFromIdpService.class);
bind(SamlAuthnResponseTranslatorDtoFactory.class).toInstance(new SamlAuthnResponseTranslatorDtoFactory());
bind(IdGenerator.class).toInstance(new IdGenerator());
bind(AttributeQueryService.class);
bind(SamlSoapProxyProxy.class);
bind(ResponseFromHubFactory.class);
bind(AssertionRestrictionsFactory.class);
bind(MatchingServiceConfigProxy.class);
bind(Cycle3Service.class);
bind(MatchingServiceResponseService.class);
bind(ResponseFromIdpHandler.class);
}
use of uk.gov.ida.truststore.KeyStoreLoader 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, "/*");
}
use of uk.gov.ida.truststore.KeyStoreLoader in project verify-hub by alphagov.
the class SamlProxyModule method configure.
@Override
protected void configure() {
bind(TrustStoreConfiguration.class).to(SamlProxyConfiguration.class);
bind(RestfulClientConfiguration.class).to(SamlProxyConfiguration.class);
bind(PublicKeyInputStreamFactory.class).toInstance(new PublicKeyFileInputStreamFactory());
bind(SigningKeyStore.class).to(AuthnRequestKeyStore.class);
bind(Client.class).toProvider(DefaultClientProvider.class).in(Scopes.SINGLETON);
bind(ConfigServiceKeyStore.class).asEagerSingleton();
bind(KeyStoreLoader.class).toInstance(new KeyStoreLoader());
bind(ResponseMaxSizeValidator.class);
bind(ExpiredCertificateMetadataFilter.class).toInstance(new ExpiredCertificateMetadataFilter());
bind(X509CertificateFactory.class).toInstance(new X509CertificateFactory());
bind(CertificateChainValidator.class);
bind(CertificatesConfigProxy.class);
bind(TrustStoreForCertificateProvider.class);
bind(StringSizeValidator.class).toInstance(new StringSizeValidator());
bind(JsonResponseProcessor.class);
bind(PKIXParametersProvider.class).toInstance(new PKIXParametersProvider());
bind(RelayStateValidator.class).toInstance(new RelayStateValidator());
bind(ProtectiveMonitoringLogFormatter.class).toInstance(new ProtectiveMonitoringLogFormatter());
bind(KeyStoreCache.class);
bind(EventSinkMessageSender.class);
bind(ExceptionAuditor.class);
bind(ProtectiveMonitoringLogger.class);
bind(SessionProxy.class);
bind(new TypeLiteral<LevelLoggerFactory<SamlProxySamlTransformationErrorExceptionMapper>>() {
}).toInstance(new LevelLoggerFactory<>());
bind(new TypeLiteral<LevelLoggerFactory<SamlProxyDuplicateRequestExceptionMapper>>() {
}).toInstance(new LevelLoggerFactory<>());
bind(new TypeLiteral<LevelLoggerFactory<NoKeyConfiguredForEntityExceptionMapper>>() {
}).toInstance(new LevelLoggerFactory<>());
bind(new TypeLiteral<LevelLoggerFactory<SamlProxyApplicationExceptionMapper>>() {
}).toInstance(new LevelLoggerFactory<>());
bind(new TypeLiteral<LevelLoggerFactory<SamlProxyExceptionMapper>>() {
}).toInstance(new LevelLoggerFactory<>());
bind(SamlMessageSenderHandler.class);
bind(ExternalCommunicationEventLogger.class);
bind(IpAddressResolver.class).toInstance(new IpAddressResolver());
}
Aggregations