use of com.google.inject.assistedinject.FactoryModuleBuilder in project OpenAM by OpenRock.
the class SelfServiceGuiceModule method configure.
@Override
protected void configure() {
install(new FactoryModuleBuilder().implement(SnapshotTokenHandlerFactory.class, JwtSnapshotTokenHandlerFactory.class).build(new TypeLiteral<KeyPairInjector<SnapshotTokenHandlerFactory>>() {
}));
bind(ProcessStore.class).to(ProcessStoreImpl.class);
bind(ServiceConfigProviderFactory.class).to(ServiceConfigProviderFactoryImpl.class);
bind(SelfServiceFactory.class).to(SelfServiceFactoryImpl.class);
bind(KbaResource.class);
try {
bind(Client.class).annotatedWith(SelfService.class).toInstance(new Client(new HttpClientHandler()));
} catch (HttpApplicationException haE) {
throw new HttpClientCreationException("Unable to create http client", haE);
}
// Registration CREST services
expose(new TypeLiteral<SelfServiceRequestHandler<UserRegistrationConsoleConfig>>() {
});
expose(new TypeLiteral<SelfServiceRequestHandler<ForgottenPasswordConsoleConfig>>() {
});
expose(new TypeLiteral<SelfServiceRequestHandler<ForgottenUsernameConsoleConfig>>() {
});
expose(UserUpdateService.class);
expose(KbaResource.class);
// Exposed to be accessible to custom progress stages
expose(ConnectionFactory.class).annotatedWith(SelfService.class);
expose(Client.class).annotatedWith(SelfService.class);
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project OpenAM by OpenRock.
the class DataLayerGuiceModule method configure.
@Override
protected void configure() {
bind(TokenIdGenerator.class).to(ThreadSafeTokenIdGenerator.class);
install(new FactoryModuleBuilder().implement(JavaBeanAdapter.class, JavaBeanAdapter.class).build(JavaBeanAdapterFactory.class));
Key<Map<ConnectionType, LdapDataLayerConfiguration>> connectionMapKey = Key.get(new TypeLiteral<Map<ConnectionType, LdapDataLayerConfiguration>>() {
});
binder().bind(connectionMapKey).toProvider(ConfigurationMapProvider.class).in(Singleton.class);
for (ConnectionType connectionType : ConnectionType.values()) {
if (connectionType != ConnectionType.UMA_LABELS) {
try {
DataLayerConnectionModule module = connectionType.getConfigurationClass().newInstance();
module.setConnectionType(connectionType);
binder().install(module);
} catch (Exception e) {
throw new IllegalStateException("Could not initialise connection module for " + connectionType, e);
}
}
}
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project OpenAM by OpenRock.
the class ScriptingGuiceModule method configure.
@Override
protected void configure() {
bind(ScriptValidator.class).to(StandardScriptValidator.class);
bind(Logger.class).annotatedWith(Names.named("ScriptLogger")).toInstance(logger);
install(new FactoryModuleBuilder().implement(new TypeLiteral<ScriptingService>() {
}, ScriptConfigurationService.class).build(new TypeLiteral<ScriptingServiceFactory>() {
}));
install(new FactoryModuleBuilder().implement(new TypeLiteral<ScriptingDataStore>() {
}, ScriptConfigurationDataStore.class).build(new TypeLiteral<ScriptingDataStoreFactory>() {
}));
bind(StandardScriptEngineManager.class).annotatedWith(Names.named(AUTHENTICATION_SERVER_SIDE.name())).toInstance(new StandardScriptEngineManager());
bind(StandardScriptEngineManager.class).annotatedWith(Names.named(POLICY_CONDITION.name())).toInstance(new StandardScriptEngineManager());
bind(StandardScriptEngineManager.class).annotatedWith(Names.named(OIDC_CLAIMS.name())).toInstance(new StandardScriptEngineManager());
bind(RestletHttpClient.class).annotatedWith(Names.named(SupportedScriptingLanguage.JAVASCRIPT.name())).to(JavaScriptHttpClient.class);
bind(RestletHttpClient.class).annotatedWith(Names.named(SupportedScriptingLanguage.GROOVY.name())).to(GroovyHttpClient.class);
try {
bind(Client.class).annotatedWith(Names.named("ScriptingHttpClient")).toInstance(new Client(new HttpClientHandler()));
} catch (HttpApplicationException e) {
logger.error("Failed to create HttpClientHandler", e);
}
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project OpenAM by OpenRock.
the class OAuth2GuiceModule method configure.
/**
* {@inheritDoc}
*/
@Override
protected void configure() {
bind(AuthorizationService.class).to(AuthorizationServiceImpl.class);
bind(new TypeLiteral<OAuth2RequestFactory<?, Request>>() {
}).to(RestletOAuth2RequestFactory.class);
bind(ResourceOwnerConsentVerifier.class).to(OpenIdResourceOwnerConsentVerifier.class);
bind(ClientRegistrationStore.class).to(OpenAMClientRegistrationStore.class);
bind(OpenIdConnectClientRegistrationStore.class).to(OpenAMClientRegistrationStore.class);
bind(OAuth2ProviderSettingsFactory.class).to(OpenAMOAuth2ProviderSettingsFactory.class);
bind(OAuth2ProviderSettingsFactory.class).to(OpenAMOAuth2ProviderSettingsFactory.class);
bind(ResourceOwnerSessionValidator.class).to(OpenAMResourceOwnerSessionValidator.class);
bind(ClientAuthenticator.class).to(ClientAuthenticatorImpl.class);
bind(TokenStore.class).to(OpenAMTokenStore.class);
bind(OpenIdConnectTokenStore.class).to(OpenAMTokenStore.class);
bind(AccessTokenService.class).to(AccessTokenServiceImpl.class);
bind(ResourceOwnerAuthenticator.class).to(OpenAMResourceOwnerAuthenticator.class);
bind(IdTokenResponseTypeHandler.class).to(OpenAMIdTokenResponseTypeHandler.class);
bind(UserInfoService.class).to(UserInfoServiceImpl.class);
bind(TokenInfoService.class).to(TokenInfoServiceImpl.class);
bind(ClientAuthenticationFailureFactory.class).to(OpenAMClientAuthenticationFailureFactory.class);
bind(AccessTokenVerifier.class).to(RestletHeaderAccessTokenVerifier.class);
bind(AccessTokenVerifier.class).annotatedWith(named(HEADER)).to(RestletHeaderAccessTokenVerifier.class);
bind(AccessTokenVerifier.class).annotatedWith(named(FORM_BODY)).to(RestletFormBodyAccessTokenVerifier.class);
bind(AccessTokenVerifier.class).annotatedWith(named(QUERY_PARAM)).to(RestletQueryParameterAccessTokenVerifier.class);
bind(OpenIDConnectProvider.class).to(OpenAMOpenIDConnectProvider.class);
bind(ClientDAO.class).to(OpenAMClientDAO.class);
bind(OpenIdConnectClientRegistrationService.class).to(OpenAMOpenIdConnectClientRegistrationService.class);
bind(OpenAMSettings.class).toProvider(new Provider<OpenAMSettings>() {
public OpenAMSettings get() {
return new OpenAMSettingsImpl(OAuth2Constants.OAuth2ProviderService.NAME, OAuth2Constants.OAuth2ProviderService.VERSION);
}
});
bind(OpenIDTokenIssuer.class).to(OpenAMOpenIdTokenIssuer.class);
final Multibinder<AuthorizeRequestValidator> authorizeRequestValidators = Multibinder.newSetBinder(binder(), AuthorizeRequestValidator.class);
authorizeRequestValidators.addBinding().to(AuthorizeRequestValidatorImpl.class);
authorizeRequestValidators.addBinding().to(OpenIdConnectAuthorizeRequestValidator.class);
authorizeRequestValidators.addBinding().to(ClaimsParameterValidator.class);
authorizeRequestValidators.addBinding().to(SubjectTypeValidator.class);
authorizeRequestValidators.addBinding().to(CodeVerifierValidator.class);
final Multibinder<AuthorizationCodeRequestValidator> authorizationCodeRequestValidators = Multibinder.newSetBinder(binder(), AuthorizationCodeRequestValidator.class);
authorizationCodeRequestValidators.addBinding().to(AuthorizationCodeRequestValidatorImpl.class);
final Multibinder<ClientCredentialsRequestValidator> clientCredentialsRequestValidators = Multibinder.newSetBinder(binder(), ClientCredentialsRequestValidator.class);
clientCredentialsRequestValidators.addBinding().to(ClientCredentialsRequestValidatorImpl.class);
final Multibinder<PasswordCredentialsRequestValidator> passwordCredentialsRequestValidators = Multibinder.newSetBinder(binder(), PasswordCredentialsRequestValidator.class);
passwordCredentialsRequestValidators.addBinding().to(PasswordCredentialsRequestValidatorImpl.class);
final MapBinder<String, GrantTypeHandler> grantTypeHandlers = MapBinder.newMapBinder(binder(), String.class, GrantTypeHandler.class);
grantTypeHandlers.addBinding(CLIENT_CREDENTIALS).to(ClientCredentialsGrantTypeHandler.class);
grantTypeHandlers.addBinding(PASSWORD).to(PasswordCredentialsGrantTypeHandler.class);
grantTypeHandlers.addBinding(AUTHORIZATION_CODE).to(AuthorizationCodeGrantTypeHandler.class);
grantTypeHandlers.addBinding(DEVICE_CODE).to(DeviceCodeGrantTypeHandler.class);
grantTypeHandlers.addBinding(JWT_BEARER).to(JwtBearerGrantTypeHandler.class);
grantTypeHandlers.addBinding(OAuth2Constants.TokenEndpoint.SAML2_BEARER).to(Saml2GrantTypeHandler.class);
final Multibinder<AuthorizeRequestHook> authorizeRequestHooks = Multibinder.newSetBinder(binder(), AuthorizeRequestHook.class);
authorizeRequestHooks.addBinding().to(LoginHintHook.class);
final Multibinder<TokenRequestHook> tokenRequestHooks = Multibinder.newSetBinder(binder(), TokenRequestHook.class);
tokenRequestHooks.addBinding().to(LoginHintHook.class);
install(new FactoryModuleBuilder().implement(ResourceSetStore.class, OpenAMResourceSetStore.class).build(ResourceSetStoreFactory.class));
bind(TokenIdGenerator.class).to(ThreadSafeTokenIdGenerator.class);
Multibinder.newSetBinder(binder(), TokenIntrospectionHandler.class).addBinding().to(OAuth2TokenIntrospectionHandler.class);
bind(TokenIntrospectionService.class).to(TokenIntrospectionServiceImpl.class);
Multibinder.newSetBinder(binder(), ResourceSetRegistrationHook.class);
bind(OpenIDConnectURLValidator.class).toInstance(OpenIDConnectURLValidator.getInstance());
install(new LabelsGuiceModule());
bind(OAuth2UrisFactory.class).to(OpenAMOAuth2UrisFactory.class);
bind(new TypeLiteral<OAuth2UrisFactory<RealmInfo>>() {
}).to(OpenAMOAuth2UrisFactory.class);
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project OpenAM by OpenRock.
the class UmaGuiceModule method configure.
@Override
protected void configure() {
bind(Key.get(Router.class, Names.named("UMARouter"))).toProvider(UmaRouterProvider.class).in(Singleton.class);
bind(UmaPolicyService.class).to(UmaPolicyServiceImpl.class);
Multibinder.newSetBinder(binder(), IdRepoCreationListener.class).addBinding().to(UmaIdRepoCreationListener.class);
Multibinder.newSetBinder(binder(), ResourceSetRegistrationHook.class).addBinding().to(UmaResourceSetRegistrationHook.class);
install(new FactoryModuleBuilder().implement(UmaTokenStore.class, UmaTokenStore.class).build(UmaTokenStoreFactory.class));
Multibinder.newSetBinder(binder(), TokenIntrospectionHandler.class).addBinding().to(UmaTokenIntrospectionHandler.class);
install(new FactoryModuleBuilder().implement(UmaSettings.class, UmaSettingsImpl.class).build(UmaSettingsFactory.class));
MapBinder.newMapBinder(binder(), String.class, ClaimGatherer.class).addBinding(IdTokenClaimGatherer.FORMAT).to(IdTokenClaimGatherer.class);
Multibinder.newSetBinder(binder(), SMSAuditFilter.class).addBinding().to(UmaAuditFilter.class);
Multibinder.newSetBinder(binder(), UiRolePredicate.class).addBinding().to(UmaUserUiRolePredicate.class);
}
Aggregations