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);
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations