use of javax.inject.Inject in project toydi by tokuhirom.
the class ToyDI method instantiateMembers.
public void instantiateMembers(Object object) throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
for (final Field field : object.getClass().getDeclaredFields()) {
Inject inject = field.getAnnotation(Inject.class);
if (inject != null) {
field.setAccessible(true);
final Class<?> type = field.getType();
Object value = this.getInstance(type);
field.set(object, value);
}
}
}
use of javax.inject.Inject 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.Inject in project OpenAM by OpenRock.
the class CoreRestGuiceModule method getSessionResourceAuthzModule.
@Provides
@Inject
public AnyOfAuthzModule getSessionResourceAuthzModule(SSOTokenManager ssoTokenManager, PrivilegeAuthzModule privilegeAuthzModule, AdminOnlyAuthzModule adminOnlyAuthzModule) {
SessionResourceAuthzModule sessionResourceAuthzModule = new SessionResourceAuthzModule(ssoTokenManager);
List<CrestAuthorizationModule> authzList = new ArrayList<>(3);
authzList.add(adminOnlyAuthzModule);
authzList.add(privilegeAuthzModule);
authzList.add(sessionResourceAuthzModule);
return new AnyOfAuthzModule(authzList);
}
use of javax.inject.Inject 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.Inject in project OpenAM by OpenRock.
the class SoapSTSInstanceModule method getSTSProperties.
/**
* This method will provide the instance of the STSPropertiesMBean necessary both for the STS proper, and for the
* CXF interceptor-set which enforces the SecurityPolicy bindings.
*
* It should be a singleton because this same instance is shared by all of the token operation instances, as well as
* by the CXF interceptor-set
*/
@Provides
@Singleton
@Inject
STSPropertiesMBean getSTSProperties(Logger logger) {
StaticSTSProperties stsProperties = new StaticSTSProperties();
// KeystoreConfig may be null for a TLS-based SecurityPolicy binding, or for the AM-bare binding.
if (stsInstanceConfig.getKeystoreConfig() != null) {
stsProperties.setCallbackHandler(new SoapSTSCallbackHandler(stsInstanceConfig.getKeystoreConfig(), logger));
Crypto crypto;
try {
crypto = CryptoFactory.getInstance(getEncryptionProperties());
} catch (WSSecurityException e) {
String message = "Exception caught initializing the CryptoFactory: " + e;
logger.error(message, e);
throw new IllegalStateException(message);
}
stsProperties.setSignatureCrypto(crypto);
stsProperties.setEncryptionCrypto(crypto);
stsProperties.setSignatureUsername(stsInstanceConfig.getKeystoreConfig().getSignatureKeyAlias());
}
return stsProperties;
}
Aggregations