Search in sources :

Example 1 with StrictGuiceModule

use of keywhiz.inject.StrictGuiceModule in project keywhiz by square.

the class CryptoModuleTest method secureRandomIsExplicitlyBound.

@Test
public void secureRandomIsExplicitlyBound() {
    KeywhizConfig config = ServiceContext.create().getConfig();
    Injector injector = Guice.createInjector(new CryptoModule(config.getDerivationProviderClass(), config.getContentKeyStore()), new StrictGuiceModule());
    assertNotNull(injector.getInstance(SecureRandom.class));
}
Also used : Injector(com.google.inject.Injector) KeywhizConfig(keywhiz.KeywhizConfig) SecureRandom(java.security.SecureRandom) StrictGuiceModule(keywhiz.inject.StrictGuiceModule) Test(org.junit.Test)

Example 2 with StrictGuiceModule

use of keywhiz.inject.StrictGuiceModule in project keywhiz by square.

the class ServiceModule method configure.

@Override
protected void configure() {
    // Initialize the BouncyCastle security provider for cryptography support.
    BouncyCastle.require();
    bind(ClientCertificateFilter.class).toProvider(ClientCertificateFilter::new);
    bind(Clock.class).toInstance(Clock.systemUTC());
    bind(CookieConfig.class).annotatedWith(SessionCookie.class).toInstance(config.getSessionCookieConfig());
    bind(SecurityHeadersFilter.class).toProvider(SecurityHeadersFilter::new);
    bind(SessionMeResource.class).toProvider(SessionMeResource::new);
    install(new ContextModule(config, environment));
    install(new CookieModule(config.getCookieKey()));
    install(new CryptoModule(config.getDerivationProviderClass(), config.getContentKeyStore()));
    install(new DaoModule());
    install(new StrictGuiceModule());
}
Also used : ClientCertificateFilter(keywhiz.auth.mutualssl.ClientCertificateFilter) CryptoModule(keywhiz.service.crypto.CryptoModule) ContextModule(keywhiz.inject.ContextModule) SessionCookie(keywhiz.auth.cookie.SessionCookie) SessionMeResource(keywhiz.service.resources.admin.SessionMeResource) CookieModule(keywhiz.auth.cookie.CookieModule) Clock(java.time.Clock) SecurityHeadersFilter(keywhiz.service.filters.SecurityHeadersFilter) DaoModule(keywhiz.service.daos.DaoModule) StrictGuiceModule(keywhiz.inject.StrictGuiceModule)

Aggregations

StrictGuiceModule (keywhiz.inject.StrictGuiceModule)2 Injector (com.google.inject.Injector)1 SecureRandom (java.security.SecureRandom)1 Clock (java.time.Clock)1 KeywhizConfig (keywhiz.KeywhizConfig)1 CookieModule (keywhiz.auth.cookie.CookieModule)1 SessionCookie (keywhiz.auth.cookie.SessionCookie)1 ClientCertificateFilter (keywhiz.auth.mutualssl.ClientCertificateFilter)1 ContextModule (keywhiz.inject.ContextModule)1 CryptoModule (keywhiz.service.crypto.CryptoModule)1 DaoModule (keywhiz.service.daos.DaoModule)1 SecurityHeadersFilter (keywhiz.service.filters.SecurityHeadersFilter)1 SessionMeResource (keywhiz.service.resources.admin.SessionMeResource)1 Test (org.junit.Test)1