use of com.hubspot.singularity.auth.authenticator.SingularityAuthenticator in project Singularity by HubSpot.
the class SingularityAuthModule method configure.
@Override
public void configure(Binder binder) {
Multibinder<SingularityAuthenticator> multibinder = Multibinder.newSetBinder(binder, SingularityAuthenticator.class);
for (SingularityAuthenticatorClass clazz : getConfiguration().getAuthConfiguration().getAuthenticators()) {
multibinder.addBinding().to(clazz.getAuthenticatorClass());
if (clazz == SingularityAuthenticatorClass.WEBHOOK) {
AuthConfiguration authConfiguration = getConfiguration().getAuthConfiguration();
AsyncHttpClientConfig clientConfig = new AsyncHttpClientConfig.Builder().setConnectionTimeoutInMs(authConfiguration.getWebhookAuthConnectTimeoutMs()).setRequestTimeoutInMs(authConfiguration.getWebhookAuthRequestTimeoutMs()).setMaxRequestRetry(authConfiguration.getWebhookAuthRetries()).build();
SingularityAsyncHttpClient webhookAsyncHttpClient = new SingularityAsyncHttpClient(clientConfig);
binder.bind(AsyncHttpClient.class).annotatedWith(Names.named(WEBHOOK_AUTH_HTTP_CLIENT)).toInstance(webhookAsyncHttpClient);
}
}
binder.bind(SingularityAuthFeature.class);
binder.bind(SingularityMultiMethodAuthenticator.class);
binder.bind(SingularityAuthDatastore.class).to(getConfiguration().getAuthConfiguration().getDatastore().getAuthDatastoreClass());
binder.bind(SingularityAuthorizationHelper.class).in(Scopes.SINGLETON);
}
Aggregations