Search in sources :

Example 91 with Singleton

use of javax.inject.Singleton in project OpenAM by OpenRock.

the class SoapSTSModule method getAMInternalKeyStore.

@Provides
@Singleton
KeyStore getAMInternalKeyStore() {
    try {
        final KeyStore soapSTSKeystore = KeyStore.getInstance(SharedSTSConstants.AM_INTERNAL_SOAP_STS_KEYSTORE_TYPE);
        soapSTSKeystore.load(getClass().getResourceAsStream("/" + SharedSTSConstants.AM_INTERNAL_SOAP_STS_KEYSTORE), SharedSTSConstants.AM_INTERNAL_SOAP_STS_KEYSTORE_PW.toCharArray());
        return soapSTSKeystore;
    } catch (KeyStoreException | CertificateException | IOException | NoSuchAlgorithmException e) {
        throw new IllegalStateException("Could not initialize soap-sts internal keystore. A JCEKS keystore with name " + SharedSTSConstants.AM_INTERNAL_SOAP_STS_KEYSTORE + " must be in the WEB-INF/classes directory of " + "the soap-sts .war. Exception: " + e);
    }
}
Also used : CertificateException(java.security.cert.CertificateException) KeyStoreException(java.security.KeyStoreException) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) KeyStore(java.security.KeyStore) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 92 with Singleton

use of javax.inject.Singleton in project OpenAM by OpenRock.

the class OAuth2GuiceModule method getOAuth2AuditContextProviders.

@Inject
@Provides
@Singleton
@Named(OAUTH2_AUDIT_CONTEXT_PROVIDERS)
Set<OAuth2AuditContextProvider> getOAuth2AuditContextProviders(TokenStore tokenStore, OAuth2RequestFactory<?, Request> requestFactory) {
    Set<OAuth2AuditContextProvider> set = new HashSet<>();
    set.add(new OAuth2AuditAccessTokenContextProvider(tokenStore, requestFactory));
    set.add(new OAuth2AuditRefreshTokenContextProvider(tokenStore, requestFactory));
    set.add(new OAuth2AuditSSOTokenContextProvider());
    return set;
}
Also used : OAuth2AuditRefreshTokenContextProvider(org.forgerock.openam.rest.audit.OAuth2AuditRefreshTokenContextProvider) OAuth2AuditContextProvider(org.forgerock.openam.rest.audit.OAuth2AuditContextProvider) OAuth2AuditAccessTokenContextProvider(org.forgerock.openam.rest.audit.OAuth2AuditAccessTokenContextProvider) OAuth2AuditSSOTokenContextProvider(org.forgerock.openam.rest.audit.OAuth2AuditSSOTokenContextProvider) HashSet(java.util.HashSet) Inject(javax.inject.Inject) Named(javax.inject.Named) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 93 with Singleton

use of javax.inject.Singleton in project OpenAM by OpenRock.

the class CoreGuiceModule method getSessionBlacklist.

@Provides
@Singleton
@Inject
public static SessionBlacklist getSessionBlacklist(final CTSSessionBlacklist ctsBlacklist, final SessionServiceConfig serviceConfig) {
    if (!serviceConfig.isSessionBlacklistingEnabled()) {
        return NoOpSessionBlacklist.INSTANCE;
    }
    final long purgeDelayMs = serviceConfig.getSessionBlacklistPurgeDelay(TimeUnit.MILLISECONDS);
    final int cacheSize = serviceConfig.getSessionBlacklistCacheSize();
    final long pollIntervalMs = serviceConfig.getSessionBlacklistPollInterval(TimeUnit.MILLISECONDS);
    SessionBlacklist blacklist = ctsBlacklist;
    if (cacheSize > 0) {
        blacklist = new CachingSessionBlacklist(blacklist, cacheSize, purgeDelayMs);
    }
    if (pollIntervalMs > 0) {
        blacklist = new BloomFilterSessionBlacklist(blacklist, serviceConfig);
    }
    return blacklist;
}
Also used : BloomFilterSessionBlacklist(org.forgerock.openam.session.blacklist.BloomFilterSessionBlacklist) CachingSessionBlacklist(org.forgerock.openam.session.blacklist.CachingSessionBlacklist) CTSSessionBlacklist(org.forgerock.openam.session.blacklist.CTSSessionBlacklist) NoOpSessionBlacklist(org.forgerock.openam.session.blacklist.NoOpSessionBlacklist) SessionBlacklist(org.forgerock.openam.session.blacklist.SessionBlacklist) BloomFilterSessionBlacklist(org.forgerock.openam.session.blacklist.BloomFilterSessionBlacklist) CachingSessionBlacklist(org.forgerock.openam.session.blacklist.CachingSessionBlacklist) Inject(javax.inject.Inject) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 94 with Singleton

use of javax.inject.Singleton in project OpenAM by OpenRock.

the class RestGuiceModule method getCrestRootRouter.

@Provides
@Named("CrestRootRouter")
@Singleton
Router getCrestRootRouter(@Named("CrestRealmRouter") Router crestRealmRouter) {
    Router crestRootRouter = new Router();
    crestRootRouter.setDefaultRoute(crestRealmRouter);
    return crestRealmRouter;
}
Also used : Router(org.forgerock.json.resource.Router) Named(javax.inject.Named) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 95 with Singleton

use of javax.inject.Singleton in project OpenAM by OpenRock.

the class RestGuiceModule method getChfRealmRouter.

@Provides
@Named("ChfRealmRouter")
@Singleton
org.forgerock.http.routing.Router getChfRealmRouter(@Named("CrestRealmHandler") RequestHandler crestRealmHandler, ContextFilter contextFilter, CrestProtocolEnforcementFilter crestProtocolEnforcementFilter) {
    org.forgerock.http.routing.Router chfRealmRouter = new org.forgerock.http.routing.Router();
    chfRealmRouter.setDefaultRoute(Handlers.chainOf(newHttpHandler(new FilterChain(crestRealmHandler, contextFilter)), crestProtocolEnforcementFilter));
    return chfRealmRouter;
}
Also used : FilterChain(org.forgerock.json.resource.FilterChain) Router(org.forgerock.json.resource.Router) Named(javax.inject.Named) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Singleton (javax.inject.Singleton)168 Provides (dagger.Provides)98 Provides (com.google.inject.Provides)57 HttpLoggingInterceptor (okhttp3.logging.HttpLoggingInterceptor)21 Named (javax.inject.Named)17 OkHttpClient (okhttp3.OkHttpClient)17 Cache (okhttp3.Cache)10 List (java.util.List)9 ConfigBinder.configBinder (com.facebook.airlift.configuration.ConfigBinder.configBinder)8 Binder (com.google.inject.Binder)8 Module (com.google.inject.Module)8 CachingStripeMetadataSource (com.facebook.presto.orc.CachingStripeMetadataSource)7 DwrfAwareStripeMetadataSourceFactory (com.facebook.presto.orc.DwrfAwareStripeMetadataSourceFactory)7 OrcDataSourceId (com.facebook.presto.orc.OrcDataSourceId)7 StorageStripeMetadataSource (com.facebook.presto.orc.StorageStripeMetadataSource)7 StripeMetadataSource (com.facebook.presto.orc.StripeMetadataSource)7 StripeMetadataSourceFactory (com.facebook.presto.orc.StripeMetadataSourceFactory)7 CachingOrcFileTailSource (com.facebook.presto.orc.cache.CachingOrcFileTailSource)7 OrcCacheConfig (com.facebook.presto.orc.cache.OrcCacheConfig)7 OrcFileTailSource (com.facebook.presto.orc.cache.OrcFileTailSource)7