All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hubspot.singularity.config.AuthConfiguration Maven / Gradle / Ivy

package com.hubspot.singularity.config;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.validation.constraints.NotNull;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Lists;
import com.hubspot.singularity.auth.SingularityAuthDatastoreClass;
import com.hubspot.singularity.auth.SingularityAuthenticatorClass;

public class AuthConfiguration {
  @JsonProperty
  private boolean enabled = false;

  @JsonProperty
  @NotNull
  @Deprecated
  private SingularityAuthenticatorClass authenticator = SingularityAuthenticatorClass.QUERYPARAM_PASSTHROUGH;

  @JsonProperty
  @NotNull
  private List authenticators = Lists.newArrayList(SingularityAuthenticatorClass.QUERYPARAM_PASSTHROUGH);

  @JsonProperty
  @NotNull
  private SingularityAuthDatastoreClass datastore = SingularityAuthDatastoreClass.DUMMY;

  @JsonProperty
  @NotNull
  private Set requiredGroups = new HashSet<>();

  @JsonProperty
  @NotNull
  private Set adminGroups = new HashSet<>();

  @JsonProperty
  @NotNull
  private Set jitaGroups = new HashSet<>();

  @JsonProperty
  @NotNull
  private Set defaultReadOnlyGroups = new HashSet<>();

  @JsonProperty
  @NotNull
  private Set globalReadOnlyGroups = new HashSet<>();

  @JsonProperty
  @NotNull
  private String requestUserHeaderName = "X-Username";  // used by SingularityHeaderPassthroughAuthenticator

  @JsonProperty
  private int webhookAuthRequestTimeoutMs = 2000;

  @JsonProperty
  private int webhookAuthRetries = 2;

  @JsonProperty
  private int webhookAuthConnectTimeoutMs = 2000;

  public boolean isEnabled() {
    return enabled;
  }

  public void setEnabled(boolean enabled) {
    this.enabled = enabled;
  }

  @Deprecated
  public SingularityAuthenticatorClass getAuthenticator() {
    return authenticator;
  }

  public void setAuthenticator(SingularityAuthenticatorClass authenticator) {
    this.authenticator = authenticator;
    this.authenticators.add(authenticator);
  }

  public List getAuthenticators() {
    return authenticators;
  }

  public void setAuthenticators(List authenticators) {
    this.authenticators = authenticators;
  }

  public SingularityAuthDatastoreClass getDatastore() {
    return datastore;
  }

  public void setDatastore(SingularityAuthDatastoreClass datastore) {
    this.datastore = datastore;
  }

  public Set getRequiredGroups() {
    return requiredGroups;
  }

  public void setRequiredGroups(Set requiredGroups) {
    this.requiredGroups = requiredGroups;
  }

  public Set getAdminGroups() {
    return adminGroups;
  }

  public void setAdminGroups(Set adminGroups) {
    this.adminGroups = adminGroups;
  }

  public Set getJitaGroups() {
    return jitaGroups;
  }

  public void setJitaGroups(Set jitaGroups) {
    this.jitaGroups = jitaGroups;
  }

  public Set getDefaultReadOnlyGroups() {
    return defaultReadOnlyGroups;
  }

  public void setDefaultReadOnlyGroups(Set defaultReadOnlyGroups) {
    this.defaultReadOnlyGroups = defaultReadOnlyGroups;
  }

  public Set getGlobalReadOnlyGroups() {
    return globalReadOnlyGroups;
  }

  public void setGlobalReadOnlyGroups(Set globalReadOnlyGroups) {
    this.globalReadOnlyGroups = globalReadOnlyGroups;
  }

  public String getRequestUserHeaderName() {
    return requestUserHeaderName;
  }

  public void setRequestUserHeaderName(String requestUserHeaderName) {
    this.requestUserHeaderName = requestUserHeaderName;
  }

  public int getWebhookAuthRequestTimeoutMs() {
    return webhookAuthRequestTimeoutMs;
  }

  public AuthConfiguration setWebhookAuthRequestTimeoutMs(int webhookAuthRequestTimeoutMs) {
    this.webhookAuthRequestTimeoutMs = webhookAuthRequestTimeoutMs;
    return this;
  }

  public int getWebhookAuthRetries() {
    return webhookAuthRetries;
  }

  public AuthConfiguration setWebhookAuthRetries(int webhookAuthRetries) {
    this.webhookAuthRetries = webhookAuthRetries;
    return this;
  }

  public int getWebhookAuthConnectTimeoutMs() {
    return webhookAuthConnectTimeoutMs;
  }

  public AuthConfiguration setWebhookAuthConnectTimeoutMs(int webhookAuthConnectTimeoutMs) {
    this.webhookAuthConnectTimeoutMs = webhookAuthConnectTimeoutMs;
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy