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);
}
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;
}
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;
}
Aggregations