Search in sources :

Example 1 with SingularityAuthenticatorClass

use of com.hubspot.singularity.auth.SingularityAuthenticatorClass 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);
}
Also used : SingularityAuthenticatorClass(com.hubspot.singularity.auth.SingularityAuthenticatorClass) AsyncHttpClientConfig(com.ning.http.client.AsyncHttpClientConfig) SingularityAuthDatastore(com.hubspot.singularity.auth.datastore.SingularityAuthDatastore) AuthConfiguration(com.hubspot.singularity.config.AuthConfiguration) SingularityAuthenticator(com.hubspot.singularity.auth.authenticator.SingularityAuthenticator) SingularityAuthorizationHelper(com.hubspot.singularity.auth.SingularityAuthorizationHelper)

Aggregations

SingularityAuthenticatorClass (com.hubspot.singularity.auth.SingularityAuthenticatorClass)1 SingularityAuthorizationHelper (com.hubspot.singularity.auth.SingularityAuthorizationHelper)1 SingularityAuthenticator (com.hubspot.singularity.auth.authenticator.SingularityAuthenticator)1 SingularityAuthDatastore (com.hubspot.singularity.auth.datastore.SingularityAuthDatastore)1 AuthConfiguration (com.hubspot.singularity.config.AuthConfiguration)1 AsyncHttpClientConfig (com.ning.http.client.AsyncHttpClientConfig)1