Search in sources :

Example 1 with AuthConfiguration

use of com.hubspot.singularity.config.AuthConfiguration 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)

Example 2 with AuthConfiguration

use of com.hubspot.singularity.config.AuthConfiguration in project Singularity by HubSpot.

the class SingularityAuthorizationHelperTest method buildAuthDisabledConfig.

public static SingularityConfiguration buildAuthDisabledConfig() {
    AuthConfiguration authConfiguration = new AuthConfiguration();
    authConfiguration.setEnabled(false);
    SingularityConfiguration configuration = new SingularityConfiguration();
    configuration.setAuthConfiguration(authConfiguration);
    configuration.setMesosConfiguration(new MesosConfiguration());
    return configuration;
}
Also used : MesosConfiguration(com.hubspot.singularity.config.MesosConfiguration) AuthConfiguration(com.hubspot.singularity.config.AuthConfiguration) SingularityConfiguration(com.hubspot.singularity.config.SingularityConfiguration)

Example 3 with AuthConfiguration

use of com.hubspot.singularity.config.AuthConfiguration in project Singularity by HubSpot.

the class SingularityAuthorizationHelperTest method buildAuthEnabledConfig.

public static SingularityConfiguration buildAuthEnabledConfig(Set<String> requiredGroups, Set<String> adminGroups, Set<String> jitaGroups) {
    AuthConfiguration authConfiguration = new AuthConfiguration();
    authConfiguration.setEnabled(true);
    authConfiguration.setRequiredGroups(requiredGroups);
    authConfiguration.setAdminGroups(adminGroups);
    authConfiguration.setJitaGroups(jitaGroups);
    SingularityConfiguration configuration = new SingularityConfiguration();
    configuration.setAuthConfiguration(authConfiguration);
    configuration.setMesosConfiguration(new MesosConfiguration());
    return configuration;
}
Also used : MesosConfiguration(com.hubspot.singularity.config.MesosConfiguration) AuthConfiguration(com.hubspot.singularity.config.AuthConfiguration) SingularityConfiguration(com.hubspot.singularity.config.SingularityConfiguration)

Aggregations

AuthConfiguration (com.hubspot.singularity.config.AuthConfiguration)3 MesosConfiguration (com.hubspot.singularity.config.MesosConfiguration)2 SingularityConfiguration (com.hubspot.singularity.config.SingularityConfiguration)2 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 AsyncHttpClientConfig (com.ning.http.client.AsyncHttpClientConfig)1