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

org.cloudfoundry.uaa.identityproviders.SamlConfiguration Maven / Gradle / Ivy

The newest version!
package org.cloudfoundry.uaa.identityproviders;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import org.cloudfoundry.Nullable;
import org.immutables.value.Generated;

/**
 * The payload for the saml identity provider configuration
 */
@Generated(from = "_SamlConfiguration", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class SamlConfiguration extends org.cloudfoundry.uaa.identityproviders._SamlConfiguration {
  private final @Nullable List emailDomains;
  private final @Nullable String providerDescription;
  private final @Nullable String authMethod;
  private final @Nullable AttributeMappings attributeMappings;
  private final @Nullable List externalGroupsWhitelist;
  private final @Nullable Boolean storeCustomAttributes;
  private final @Nullable Boolean addShadowUserOnLogin;
  private final @Nullable Integer assertionConsumerIndex;
  private final @Nullable List authnContext;
  private final @Nullable ExternalGroupMappingMode groupMappingMode;
  private final @Nullable String iconUrl;
  private final @Nullable String idpEntityAlias;
  private final @Nullable String linkText;
  private final String metaDataLocation;
  private final @Nullable Boolean metadataTrustCheck;
  private final @Nullable String nameId;
  private final @Nullable Boolean showSamlLink;
  private final @Nullable Boolean skipSslValidation;
  private final @Nullable String socketFactoryClassName;
  private final @Nullable String zoneId;

  private SamlConfiguration(SamlConfiguration.Builder builder) {
    this.emailDomains = builder.emailDomains == null ? null : createUnmodifiableList(true, builder.emailDomains);
    this.providerDescription = builder.providerDescription;
    this.authMethod = builder.authMethod;
    this.attributeMappings = builder.attributeMappings;
    this.externalGroupsWhitelist = builder.externalGroupsWhitelist == null ? null : createUnmodifiableList(true, builder.externalGroupsWhitelist);
    this.storeCustomAttributes = builder.storeCustomAttributes;
    this.addShadowUserOnLogin = builder.addShadowUserOnLogin;
    this.assertionConsumerIndex = builder.assertionConsumerIndex;
    this.authnContext = builder.authnContext == null ? null : createUnmodifiableList(true, builder.authnContext);
    this.groupMappingMode = builder.groupMappingMode;
    this.iconUrl = builder.iconUrl;
    this.idpEntityAlias = builder.idpEntityAlias;
    this.linkText = builder.linkText;
    this.metaDataLocation = builder.metaDataLocation;
    this.metadataTrustCheck = builder.metadataTrustCheck;
    this.nameId = builder.nameId;
    this.showSamlLink = builder.showSamlLink;
    this.skipSslValidation = builder.skipSslValidation;
    this.socketFactoryClassName = builder.socketFactoryClassName;
    this.zoneId = builder.zoneId;
  }

  /**
   * List of email domains associated with the provider for the purpose of associating users to the correct origin upon invitation. If empty list, no invitations are accepted. Wildcards supported.
   */
  @JsonProperty("emailDomain")
  @Override
  public @Nullable List getEmailDomains() {
    return emailDomains;
  }

  /**
   * Human readable name/description of this provider
   */
  @JsonProperty("providerDescription")
  @Override
  public @Nullable String getProviderDescription() {
    return providerDescription;
  }

  /**
   * explicit method to authenticate against the identity provider.
   */
  @JsonProperty("authMethod")
  @Override
  public @Nullable String getAuthMethod() {
    return authMethod;
  }

  /**
   * @return The value of the {@code attributeMappings} attribute
   */
  @JsonProperty("attributeMappings")
  @Override
  public @Nullable AttributeMappings getAttributeMappings() {
    return attributeMappings;
  }

  /**
   * The external group white list
   */
  @JsonProperty("externalGroupsWhitelist")
  @Override
  public @Nullable List getExternalGroupsWhitelist() {
    return externalGroupsWhitelist;
  }

  /**
   * Set to true, to store custom user attributes to be fetched from the /userinfo endpoint
   */
  @JsonProperty("storeCustomAttributes")
  @Override
  public @Nullable Boolean getStoreCustomAttributes() {
    return storeCustomAttributes;
  }

  /**
   * Determines whether or not shadow users must be created before login by an administrator.
   */
  @JsonProperty("addShadowUserOnLogin")
  @Override
  public @Nullable Boolean getAddShadowUserOnLogin() {
    return addShadowUserOnLogin;
  }

  /**
   * SAML assertion consumer index, default is 0
   */
  @JsonProperty("assertionConsumerIndex")
  @Override
  public @Nullable Integer getAssertionConsumerIndex() {
    return assertionConsumerIndex;
  }

  /**
   * A list of AuthnContextClassRef to include in the SAML request
   */
  @JsonProperty("authnContext")
  @Override
  public @Nullable List getAuthnContext() {
    return authnContext;
  }

  /**
   * Either EXPLICITLY_MAPPED in order to map external groups to OAuth scopes using the group mappings, or AS_SCOPES to use SAML group names as scopes.
   */
  @JsonProperty("groupMappingMode")
  @Override
  public @Nullable ExternalGroupMappingMode getGroupMappingMode() {
    return groupMappingMode;
  }

  /**
   * Reserved for future use
   */
  @JsonProperty("iconUrl")
  @Override
  public @Nullable String getIconUrl() {
    return iconUrl;
  }

  /**
   * This will be set to origin by system
   */
  @JsonProperty("idpEntityAlias")
  @Override
  public @Nullable String getIdpEntityAlias() {
    return idpEntityAlias;
  }

  /**
   * The link text for the SAML IDP on the login page
   */
  @JsonProperty("linkText")
  @Override
  public @Nullable String getLinkText() {
    return linkText;
  }

  /**
   * SAML Metadata - either an XML string or a URL that will deliver XML content
   */
  @JsonProperty("metaDataLocation")
  @Override
  public String getMetaDataLocation() {
    return metaDataLocation;
  }

  /**
   * Should metadata be validated, defaults to false
   */
  @JsonProperty("metadataTrustCheck")
  @Override
  public @Nullable Boolean getMetadataTrustCheck() {
    return metadataTrustCheck;
  }

  /**
   * The name ID to use for the username, default is “urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified”.
   */
  @JsonProperty("nameID")
  @Override
  public @Nullable String getNameId() {
    return nameId;
  }

  /**
   * Should the SAML login link be displayed on the login page, defaults to false
   */
  @JsonProperty("showSamlLink")
  @Override
  public @Nullable Boolean getShowSamlLink() {
    return showSamlLink;
  }

  /**
   * Whether to skip SSL validation
   */
  @JsonProperty("skipSslValidation")
  @Override
  public @Nullable Boolean getSkipSslValidation() {
    return skipSslValidation;
  }

  /**
   * Either "org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory" or"org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory" depending on if the metaDataLocation of
   * type URL is HTTP or HTTPS, respectively
   */
  @JsonProperty("socketFactoryClassName")
  @Override
  public @Nullable String getSocketFactoryClassName() {
    return socketFactoryClassName;
  }

  /**
   * This will be set to the ID of the zone where the provider is being created by system
   */
  @JsonProperty("zoneId")
  @Override
  public @Nullable String getZoneId() {
    return zoneId;
  }

  /**
   * This instance is equal to all instances of {@code SamlConfiguration} that have equal attribute values.
   * @return {@code true} if {@code this} is equal to {@code another} instance
   */
  @Override
  public boolean equals(Object another) {
    if (this == another) return true;
    return another instanceof SamlConfiguration
        && equalTo(0, (SamlConfiguration) another);
  }

  private boolean equalTo(int synthetic, SamlConfiguration another) {
    return Objects.equals(emailDomains, another.emailDomains)
        && Objects.equals(providerDescription, another.providerDescription)
        && Objects.equals(authMethod, another.authMethod)
        && Objects.equals(attributeMappings, another.attributeMappings)
        && Objects.equals(externalGroupsWhitelist, another.externalGroupsWhitelist)
        && Objects.equals(storeCustomAttributes, another.storeCustomAttributes)
        && Objects.equals(addShadowUserOnLogin, another.addShadowUserOnLogin)
        && Objects.equals(assertionConsumerIndex, another.assertionConsumerIndex)
        && Objects.equals(authnContext, another.authnContext)
        && Objects.equals(groupMappingMode, another.groupMappingMode)
        && Objects.equals(iconUrl, another.iconUrl)
        && Objects.equals(idpEntityAlias, another.idpEntityAlias)
        && Objects.equals(linkText, another.linkText)
        && metaDataLocation.equals(another.metaDataLocation)
        && Objects.equals(metadataTrustCheck, another.metadataTrustCheck)
        && Objects.equals(nameId, another.nameId)
        && Objects.equals(showSamlLink, another.showSamlLink)
        && Objects.equals(skipSslValidation, another.skipSslValidation)
        && Objects.equals(socketFactoryClassName, another.socketFactoryClassName)
        && Objects.equals(zoneId, another.zoneId);
  }

  /**
   * Computes a hash code from attributes: {@code emailDomains}, {@code providerDescription}, {@code authMethod}, {@code attributeMappings}, {@code externalGroupsWhitelist}, {@code storeCustomAttributes}, {@code addShadowUserOnLogin}, {@code assertionConsumerIndex}, {@code authnContext}, {@code groupMappingMode}, {@code iconUrl}, {@code idpEntityAlias}, {@code linkText}, {@code metaDataLocation}, {@code metadataTrustCheck}, {@code nameId}, {@code showSamlLink}, {@code skipSslValidation}, {@code socketFactoryClassName}, {@code zoneId}.
   * @return hashCode value
   */
  @Override
  public int hashCode() {
    int h = 5381;
    h += (h << 5) + Objects.hashCode(emailDomains);
    h += (h << 5) + Objects.hashCode(providerDescription);
    h += (h << 5) + Objects.hashCode(authMethod);
    h += (h << 5) + Objects.hashCode(attributeMappings);
    h += (h << 5) + Objects.hashCode(externalGroupsWhitelist);
    h += (h << 5) + Objects.hashCode(storeCustomAttributes);
    h += (h << 5) + Objects.hashCode(addShadowUserOnLogin);
    h += (h << 5) + Objects.hashCode(assertionConsumerIndex);
    h += (h << 5) + Objects.hashCode(authnContext);
    h += (h << 5) + Objects.hashCode(groupMappingMode);
    h += (h << 5) + Objects.hashCode(iconUrl);
    h += (h << 5) + Objects.hashCode(idpEntityAlias);
    h += (h << 5) + Objects.hashCode(linkText);
    h += (h << 5) + metaDataLocation.hashCode();
    h += (h << 5) + Objects.hashCode(metadataTrustCheck);
    h += (h << 5) + Objects.hashCode(nameId);
    h += (h << 5) + Objects.hashCode(showSamlLink);
    h += (h << 5) + Objects.hashCode(skipSslValidation);
    h += (h << 5) + Objects.hashCode(socketFactoryClassName);
    h += (h << 5) + Objects.hashCode(zoneId);
    return h;
  }

  /**
   * Prints the immutable value {@code SamlConfiguration} with attribute values.
   * @return A string representation of the value
   */
  @Override
  public String toString() {
    return "SamlConfiguration{"
        + "emailDomains=" + emailDomains
        + ", providerDescription=" + providerDescription
        + ", authMethod=" + authMethod
        + ", attributeMappings=" + attributeMappings
        + ", externalGroupsWhitelist=" + externalGroupsWhitelist
        + ", storeCustomAttributes=" + storeCustomAttributes
        + ", addShadowUserOnLogin=" + addShadowUserOnLogin
        + ", assertionConsumerIndex=" + assertionConsumerIndex
        + ", authnContext=" + authnContext
        + ", groupMappingMode=" + groupMappingMode
        + ", iconUrl=" + iconUrl
        + ", idpEntityAlias=" + idpEntityAlias
        + ", linkText=" + linkText
        + ", metaDataLocation=" + metaDataLocation
        + ", metadataTrustCheck=" + metadataTrustCheck
        + ", nameId=" + nameId
        + ", showSamlLink=" + showSamlLink
        + ", skipSslValidation=" + skipSslValidation
        + ", socketFactoryClassName=" + socketFactoryClassName
        + ", zoneId=" + zoneId
        + "}";
  }

  /**
   * Utility type used to correctly read immutable object from JSON representation.
   * @deprecated Do not use this type directly, it exists only for the Jackson-binding infrastructure
   */
  @Generated(from = "_SamlConfiguration", generator = "Immutables")
  @Deprecated
  @JsonDeserialize
  @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
  static final class Json extends org.cloudfoundry.uaa.identityproviders._SamlConfiguration {
    List emailDomains = null;
    String providerDescription;
    String authMethod;
    AttributeMappings attributeMappings;
    List externalGroupsWhitelist = null;
    Boolean storeCustomAttributes;
    Boolean addShadowUserOnLogin;
    Integer assertionConsumerIndex;
    List authnContext = null;
    ExternalGroupMappingMode groupMappingMode;
    String iconUrl;
    String idpEntityAlias;
    String linkText;
    String metaDataLocation;
    Boolean metadataTrustCheck;
    String nameId;
    Boolean showSamlLink;
    Boolean skipSslValidation;
    String socketFactoryClassName;
    String zoneId;
    @JsonProperty("emailDomain")
    public void setEmailDomains(@Nullable List emailDomains) {
      this.emailDomains = emailDomains;
    }
    @JsonProperty("providerDescription")
    public void setProviderDescription(@Nullable String providerDescription) {
      this.providerDescription = providerDescription;
    }
    @JsonProperty("authMethod")
    public void setAuthMethod(@Nullable String authMethod) {
      this.authMethod = authMethod;
    }
    @JsonProperty("attributeMappings")
    public void setAttributeMappings(@Nullable AttributeMappings attributeMappings) {
      this.attributeMappings = attributeMappings;
    }
    @JsonProperty("externalGroupsWhitelist")
    public void setExternalGroupsWhitelist(@Nullable List externalGroupsWhitelist) {
      this.externalGroupsWhitelist = externalGroupsWhitelist;
    }
    @JsonProperty("storeCustomAttributes")
    public void setStoreCustomAttributes(@Nullable Boolean storeCustomAttributes) {
      this.storeCustomAttributes = storeCustomAttributes;
    }
    @JsonProperty("addShadowUserOnLogin")
    public void setAddShadowUserOnLogin(@Nullable Boolean addShadowUserOnLogin) {
      this.addShadowUserOnLogin = addShadowUserOnLogin;
    }
    @JsonProperty("assertionConsumerIndex")
    public void setAssertionConsumerIndex(@Nullable Integer assertionConsumerIndex) {
      this.assertionConsumerIndex = assertionConsumerIndex;
    }
    @JsonProperty("authnContext")
    public void setAuthnContext(@Nullable List authnContext) {
      this.authnContext = authnContext;
    }
    @JsonProperty("groupMappingMode")
    public void setGroupMappingMode(@Nullable ExternalGroupMappingMode groupMappingMode) {
      this.groupMappingMode = groupMappingMode;
    }
    @JsonProperty("iconUrl")
    public void setIconUrl(@Nullable String iconUrl) {
      this.iconUrl = iconUrl;
    }
    @JsonProperty("idpEntityAlias")
    public void setIdpEntityAlias(@Nullable String idpEntityAlias) {
      this.idpEntityAlias = idpEntityAlias;
    }
    @JsonProperty("linkText")
    public void setLinkText(@Nullable String linkText) {
      this.linkText = linkText;
    }
    @JsonProperty("metaDataLocation")
    public void setMetaDataLocation(String metaDataLocation) {
      this.metaDataLocation = metaDataLocation;
    }
    @JsonProperty("metadataTrustCheck")
    public void setMetadataTrustCheck(@Nullable Boolean metadataTrustCheck) {
      this.metadataTrustCheck = metadataTrustCheck;
    }
    @JsonProperty("nameID")
    public void setNameId(@Nullable String nameId) {
      this.nameId = nameId;
    }
    @JsonProperty("showSamlLink")
    public void setShowSamlLink(@Nullable Boolean showSamlLink) {
      this.showSamlLink = showSamlLink;
    }
    @JsonProperty("skipSslValidation")
    public void setSkipSslValidation(@Nullable Boolean skipSslValidation) {
      this.skipSslValidation = skipSslValidation;
    }
    @JsonProperty("socketFactoryClassName")
    public void setSocketFactoryClassName(@Nullable String socketFactoryClassName) {
      this.socketFactoryClassName = socketFactoryClassName;
    }
    @JsonProperty("zoneId")
    public void setZoneId(@Nullable String zoneId) {
      this.zoneId = zoneId;
    }
    @Override
    public List getEmailDomains() { throw new UnsupportedOperationException(); }
    @Override
    public String getProviderDescription() { throw new UnsupportedOperationException(); }
    @Override
    public String getAuthMethod() { throw new UnsupportedOperationException(); }
    @Override
    public AttributeMappings getAttributeMappings() { throw new UnsupportedOperationException(); }
    @Override
    public List getExternalGroupsWhitelist() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getStoreCustomAttributes() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getAddShadowUserOnLogin() { throw new UnsupportedOperationException(); }
    @Override
    public Integer getAssertionConsumerIndex() { throw new UnsupportedOperationException(); }
    @Override
    public List getAuthnContext() { throw new UnsupportedOperationException(); }
    @Override
    public ExternalGroupMappingMode getGroupMappingMode() { throw new UnsupportedOperationException(); }
    @Override
    public String getIconUrl() { throw new UnsupportedOperationException(); }
    @Override
    public String getIdpEntityAlias() { throw new UnsupportedOperationException(); }
    @Override
    public String getLinkText() { throw new UnsupportedOperationException(); }
    @Override
    public String getMetaDataLocation() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getMetadataTrustCheck() { throw new UnsupportedOperationException(); }
    @Override
    public String getNameId() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getShowSamlLink() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getSkipSslValidation() { throw new UnsupportedOperationException(); }
    @Override
    public String getSocketFactoryClassName() { throw new UnsupportedOperationException(); }
    @Override
    public String getZoneId() { throw new UnsupportedOperationException(); }
  }

  /**
   * @param json A JSON-bindable data structure
   * @return An immutable value type
   * @deprecated Do not use this method directly, it exists only for the Jackson-binding infrastructure
   */
  @Deprecated
  @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
  static SamlConfiguration fromJson(Json json) {
    SamlConfiguration.Builder builder = SamlConfiguration.builder();
    if (json.emailDomains != null) {
      builder.addAllEmailDomains(json.emailDomains);
    }
    if (json.providerDescription != null) {
      builder.providerDescription(json.providerDescription);
    }
    if (json.authMethod != null) {
      builder.authMethod(json.authMethod);
    }
    if (json.attributeMappings != null) {
      builder.attributeMappings(json.attributeMappings);
    }
    if (json.externalGroupsWhitelist != null) {
      builder.addAllExternalGroupsWhitelist(json.externalGroupsWhitelist);
    }
    if (json.storeCustomAttributes != null) {
      builder.storeCustomAttributes(json.storeCustomAttributes);
    }
    if (json.addShadowUserOnLogin != null) {
      builder.addShadowUserOnLogin(json.addShadowUserOnLogin);
    }
    if (json.assertionConsumerIndex != null) {
      builder.assertionConsumerIndex(json.assertionConsumerIndex);
    }
    if (json.authnContext != null) {
      builder.addAllAuthnContext(json.authnContext);
    }
    if (json.groupMappingMode != null) {
      builder.groupMappingMode(json.groupMappingMode);
    }
    if (json.iconUrl != null) {
      builder.iconUrl(json.iconUrl);
    }
    if (json.idpEntityAlias != null) {
      builder.idpEntityAlias(json.idpEntityAlias);
    }
    if (json.linkText != null) {
      builder.linkText(json.linkText);
    }
    if (json.metaDataLocation != null) {
      builder.metaDataLocation(json.metaDataLocation);
    }
    if (json.metadataTrustCheck != null) {
      builder.metadataTrustCheck(json.metadataTrustCheck);
    }
    if (json.nameId != null) {
      builder.nameId(json.nameId);
    }
    if (json.showSamlLink != null) {
      builder.showSamlLink(json.showSamlLink);
    }
    if (json.skipSslValidation != null) {
      builder.skipSslValidation(json.skipSslValidation);
    }
    if (json.socketFactoryClassName != null) {
      builder.socketFactoryClassName(json.socketFactoryClassName);
    }
    if (json.zoneId != null) {
      builder.zoneId(json.zoneId);
    }
    return builder.build();
  }

  /**
   * Creates a builder for {@link SamlConfiguration SamlConfiguration}.
   * 
   * SamlConfiguration.builder()
   *    .emailDomains(List&lt;String&gt; | null) // nullable {@link SamlConfiguration#getEmailDomains() emailDomains}
   *    .providerDescription(String | null) // nullable {@link SamlConfiguration#getProviderDescription() providerDescription}
   *    .authMethod(String | null) // nullable {@link SamlConfiguration#getAuthMethod() authMethod}
   *    .attributeMappings(org.cloudfoundry.uaa.identityproviders.AttributeMappings | null) // nullable {@link SamlConfiguration#getAttributeMappings() attributeMappings}
   *    .externalGroupsWhitelist(List&lt;String&gt; | null) // nullable {@link SamlConfiguration#getExternalGroupsWhitelist() externalGroupsWhitelist}
   *    .storeCustomAttributes(Boolean | null) // nullable {@link SamlConfiguration#getStoreCustomAttributes() storeCustomAttributes}
   *    .addShadowUserOnLogin(Boolean | null) // nullable {@link SamlConfiguration#getAddShadowUserOnLogin() addShadowUserOnLogin}
   *    .assertionConsumerIndex(Integer | null) // nullable {@link SamlConfiguration#getAssertionConsumerIndex() assertionConsumerIndex}
   *    .authnContext(List&lt;String&gt; | null) // nullable {@link SamlConfiguration#getAuthnContext() authnContext}
   *    .groupMappingMode(org.cloudfoundry.uaa.identityproviders.ExternalGroupMappingMode | null) // nullable {@link SamlConfiguration#getGroupMappingMode() groupMappingMode}
   *    .iconUrl(String | null) // nullable {@link SamlConfiguration#getIconUrl() iconUrl}
   *    .idpEntityAlias(String | null) // nullable {@link SamlConfiguration#getIdpEntityAlias() idpEntityAlias}
   *    .linkText(String | null) // nullable {@link SamlConfiguration#getLinkText() linkText}
   *    .metaDataLocation(String) // required {@link SamlConfiguration#getMetaDataLocation() metaDataLocation}
   *    .metadataTrustCheck(Boolean | null) // nullable {@link SamlConfiguration#getMetadataTrustCheck() metadataTrustCheck}
   *    .nameId(String | null) // nullable {@link SamlConfiguration#getNameId() nameId}
   *    .showSamlLink(Boolean | null) // nullable {@link SamlConfiguration#getShowSamlLink() showSamlLink}
   *    .skipSslValidation(Boolean | null) // nullable {@link SamlConfiguration#getSkipSslValidation() skipSslValidation}
   *    .socketFactoryClassName(String | null) // nullable {@link SamlConfiguration#getSocketFactoryClassName() socketFactoryClassName}
   *    .zoneId(String | null) // nullable {@link SamlConfiguration#getZoneId() zoneId}
   *    .build();
   * 
* @return A new SamlConfiguration builder */ public static SamlConfiguration.Builder builder() { return new SamlConfiguration.Builder(); } /** * Builds instances of type {@link SamlConfiguration SamlConfiguration}. * Initialize attributes and then invoke the {@link #build()} method to create an * immutable instance. *

{@code Builder} is not thread-safe and generally should not be stored in a field or collection, * but instead used immediately to create instances. */ @Generated(from = "_SamlConfiguration", generator = "Immutables") public static final class Builder { private static final long INIT_BIT_META_DATA_LOCATION = 0x1L; private long initBits = 0x1L; private List emailDomains = null; private String providerDescription; private String authMethod; private AttributeMappings attributeMappings; private List externalGroupsWhitelist = null; private Boolean storeCustomAttributes; private Boolean addShadowUserOnLogin; private Integer assertionConsumerIndex; private List authnContext = null; private ExternalGroupMappingMode groupMappingMode; private String iconUrl; private String idpEntityAlias; private String linkText; private String metaDataLocation; private Boolean metadataTrustCheck; private String nameId; private Boolean showSamlLink; private Boolean skipSslValidation; private String socketFactoryClassName; private String zoneId; private Builder() { } /** * Fill a builder with attribute values from the provided {@code org.cloudfoundry.uaa.identityproviders.AbstractIdentityProviderConfiguration} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(AbstractIdentityProviderConfiguration instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } /** * Fill a builder with attribute values from the provided {@code SamlConfiguration} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(SamlConfiguration instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } /** * Copy abstract value type {@code _SamlConfiguration} instance into builder. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(_SamlConfiguration instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } /** * Fill a builder with attribute values from the provided {@code org.cloudfoundry.uaa.identityproviders.AbstractExternalIdentityProviderConfiguration} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(AbstractExternalIdentityProviderConfiguration instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } private void from(short _unused, Object object) { long bits = 0; if (object instanceof AbstractIdentityProviderConfiguration) { AbstractIdentityProviderConfiguration instance = (AbstractIdentityProviderConfiguration) object; if ((bits & 0x20L) == 0) { String authMethodValue = instance.getAuthMethod(); if (authMethodValue != null) { authMethod(authMethodValue); } bits |= 0x20L; } if ((bits & 0x4L) == 0) { List emailDomainsValue = instance.getEmailDomains(); if (emailDomainsValue != null) { addAllEmailDomains(emailDomainsValue); } bits |= 0x4L; } if ((bits & 0x10L) == 0) { String providerDescriptionValue = instance.getProviderDescription(); if (providerDescriptionValue != null) { providerDescription(providerDescriptionValue); } bits |= 0x10L; } } if (object instanceof org.cloudfoundry.uaa.identityproviders._SamlConfiguration) { org.cloudfoundry.uaa.identityproviders._SamlConfiguration instance = (org.cloudfoundry.uaa.identityproviders._SamlConfiguration) object; if ((bits & 0x1L) == 0) { List externalGroupsWhitelistValue = instance.getExternalGroupsWhitelist(); if (externalGroupsWhitelistValue != null) { addAllExternalGroupsWhitelist(externalGroupsWhitelistValue); } bits |= 0x1L; } if ((bits & 0x2L) == 0) { AttributeMappings attributeMappingsValue = instance.getAttributeMappings(); if (attributeMappingsValue != null) { attributeMappings(attributeMappingsValue); } bits |= 0x2L; } if ((bits & 0x4L) == 0) { List emailDomainsValue = instance.getEmailDomains(); if (emailDomainsValue != null) { addAllEmailDomains(emailDomainsValue); } bits |= 0x4L; } String linkTextValue = instance.getLinkText(); if (linkTextValue != null) { linkText(linkTextValue); } if ((bits & 0x8L) == 0) { Boolean storeCustomAttributesValue = instance.getStoreCustomAttributes(); if (storeCustomAttributesValue != null) { storeCustomAttributes(storeCustomAttributesValue); } bits |= 0x8L; } Integer assertionConsumerIndexValue = instance.getAssertionConsumerIndex(); if (assertionConsumerIndexValue != null) { assertionConsumerIndex(assertionConsumerIndexValue); } Boolean addShadowUserOnLoginValue = instance.getAddShadowUserOnLogin(); if (addShadowUserOnLoginValue != null) { addShadowUserOnLogin(addShadowUserOnLoginValue); } metaDataLocation(instance.getMetaDataLocation()); Boolean skipSslValidationValue = instance.getSkipSslValidation(); if (skipSslValidationValue != null) { skipSslValidation(skipSslValidationValue); } List authnContextValue = instance.getAuthnContext(); if (authnContextValue != null) { addAllAuthnContext(authnContextValue); } Boolean showSamlLinkValue = instance.getShowSamlLink(); if (showSamlLinkValue != null) { showSamlLink(showSamlLinkValue); } Boolean metadataTrustCheckValue = instance.getMetadataTrustCheck(); if (metadataTrustCheckValue != null) { metadataTrustCheck(metadataTrustCheckValue); } if ((bits & 0x10L) == 0) { String providerDescriptionValue = instance.getProviderDescription(); if (providerDescriptionValue != null) { providerDescription(providerDescriptionValue); } bits |= 0x10L; } String nameIdValue = instance.getNameId(); if (nameIdValue != null) { nameId(nameIdValue); } String zoneIdValue = instance.getZoneId(); if (zoneIdValue != null) { zoneId(zoneIdValue); } String idpEntityAliasValue = instance.getIdpEntityAlias(); if (idpEntityAliasValue != null) { idpEntityAlias(idpEntityAliasValue); } String iconUrlValue = instance.getIconUrl(); if (iconUrlValue != null) { iconUrl(iconUrlValue); } if ((bits & 0x20L) == 0) { String authMethodValue = instance.getAuthMethod(); if (authMethodValue != null) { authMethod(authMethodValue); } bits |= 0x20L; } ExternalGroupMappingMode groupMappingModeValue = instance.getGroupMappingMode(); if (groupMappingModeValue != null) { groupMappingMode(groupMappingModeValue); } String socketFactoryClassNameValue = instance.getSocketFactoryClassName(); if (socketFactoryClassNameValue != null) { socketFactoryClassName(socketFactoryClassNameValue); } } if (object instanceof AbstractExternalIdentityProviderConfiguration) { AbstractExternalIdentityProviderConfiguration instance = (AbstractExternalIdentityProviderConfiguration) object; if ((bits & 0x1L) == 0) { List externalGroupsWhitelistValue = instance.getExternalGroupsWhitelist(); if (externalGroupsWhitelistValue != null) { addAllExternalGroupsWhitelist(externalGroupsWhitelistValue); } bits |= 0x1L; } if ((bits & 0x4L) == 0) { List emailDomainsValue = instance.getEmailDomains(); if (emailDomainsValue != null) { addAllEmailDomains(emailDomainsValue); } bits |= 0x4L; } if ((bits & 0x10L) == 0) { String providerDescriptionValue = instance.getProviderDescription(); if (providerDescriptionValue != null) { providerDescription(providerDescriptionValue); } bits |= 0x10L; } if ((bits & 0x2L) == 0) { AttributeMappings attributeMappingsValue = instance.getAttributeMappings(); if (attributeMappingsValue != null) { attributeMappings(attributeMappingsValue); } bits |= 0x2L; } if ((bits & 0x8L) == 0) { Boolean storeCustomAttributesValue = instance.getStoreCustomAttributes(); if (storeCustomAttributesValue != null) { storeCustomAttributes(storeCustomAttributesValue); } bits |= 0x8L; } if ((bits & 0x20L) == 0) { String authMethodValue = instance.getAuthMethod(); if (authMethodValue != null) { authMethod(authMethodValue); } bits |= 0x20L; } } } /** * Adds one element to {@link SamlConfiguration#getEmailDomains() emailDomains} list. * @param element A emailDomains element * @return {@code this} builder for use in a chained invocation */ public final Builder emailDomain(String element) { if (this.emailDomains == null) { this.emailDomains = new ArrayList(); } this.emailDomains.add(Objects.requireNonNull(element, "emailDomains element")); return this; } /** * Adds elements to {@link SamlConfiguration#getEmailDomains() emailDomains} list. * @param elements An array of emailDomains elements * @return {@code this} builder for use in a chained invocation */ public final Builder emailDomains(String... elements) { if (this.emailDomains == null) { this.emailDomains = new ArrayList(); } for (String element : elements) { this.emailDomains.add(Objects.requireNonNull(element, "emailDomains element")); } return this; } /** * Sets or replaces all elements for {@link SamlConfiguration#getEmailDomains() emailDomains} list. * @param elements An iterable of emailDomains elements * @return {@code this} builder for use in a chained invocation */ @JsonProperty("emailDomain") public final Builder emailDomains(@Nullable Iterable elements) { if (elements == null) { this.emailDomains = null; return this; } this.emailDomains = new ArrayList(); return addAllEmailDomains(elements); } /** * Adds elements to {@link SamlConfiguration#getEmailDomains() emailDomains} list. * @param elements An iterable of emailDomains elements * @return {@code this} builder for use in a chained invocation */ public final Builder addAllEmailDomains(Iterable elements) { Objects.requireNonNull(elements, "emailDomains element"); if (this.emailDomains == null) { this.emailDomains = new ArrayList(); } for (String element : elements) { this.emailDomains.add(Objects.requireNonNull(element, "emailDomains element")); } return this; } /** * Initializes the value for the {@link SamlConfiguration#getProviderDescription() providerDescription} attribute. * @param providerDescription The value for providerDescription (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("providerDescription") public final Builder providerDescription(@Nullable String providerDescription) { this.providerDescription = providerDescription; return this; } /** * Initializes the value for the {@link SamlConfiguration#getAuthMethod() authMethod} attribute. * @param authMethod The value for authMethod (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("authMethod") public final Builder authMethod(@Nullable String authMethod) { this.authMethod = authMethod; return this; } /** * Initializes the value for the {@link SamlConfiguration#getAttributeMappings() attributeMappings} attribute. * @param attributeMappings The value for attributeMappings (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("attributeMappings") public final Builder attributeMappings(@Nullable AttributeMappings attributeMappings) { this.attributeMappings = attributeMappings; return this; } /** * Adds one element to {@link SamlConfiguration#getExternalGroupsWhitelist() externalGroupsWhitelist} list. * @param element A externalGroupsWhitelist element * @return {@code this} builder for use in a chained invocation */ public final Builder externalGroupsWhitelist(String element) { if (this.externalGroupsWhitelist == null) { this.externalGroupsWhitelist = new ArrayList(); } this.externalGroupsWhitelist.add(Objects.requireNonNull(element, "externalGroupsWhitelist element")); return this; } /** * Adds elements to {@link SamlConfiguration#getExternalGroupsWhitelist() externalGroupsWhitelist} list. * @param elements An array of externalGroupsWhitelist elements * @return {@code this} builder for use in a chained invocation */ public final Builder externalGroupsWhitelist(String... elements) { if (this.externalGroupsWhitelist == null) { this.externalGroupsWhitelist = new ArrayList(); } for (String element : elements) { this.externalGroupsWhitelist.add(Objects.requireNonNull(element, "externalGroupsWhitelist element")); } return this; } /** * Sets or replaces all elements for {@link SamlConfiguration#getExternalGroupsWhitelist() externalGroupsWhitelist} list. * @param elements An iterable of externalGroupsWhitelist elements * @return {@code this} builder for use in a chained invocation */ @JsonProperty("externalGroupsWhitelist") public final Builder externalGroupsWhitelist(@Nullable Iterable elements) { if (elements == null) { this.externalGroupsWhitelist = null; return this; } this.externalGroupsWhitelist = new ArrayList(); return addAllExternalGroupsWhitelist(elements); } /** * Adds elements to {@link SamlConfiguration#getExternalGroupsWhitelist() externalGroupsWhitelist} list. * @param elements An iterable of externalGroupsWhitelist elements * @return {@code this} builder for use in a chained invocation */ public final Builder addAllExternalGroupsWhitelist(Iterable elements) { Objects.requireNonNull(elements, "externalGroupsWhitelist element"); if (this.externalGroupsWhitelist == null) { this.externalGroupsWhitelist = new ArrayList(); } for (String element : elements) { this.externalGroupsWhitelist.add(Objects.requireNonNull(element, "externalGroupsWhitelist element")); } return this; } /** * Initializes the value for the {@link SamlConfiguration#getStoreCustomAttributes() storeCustomAttributes} attribute. * @param storeCustomAttributes The value for storeCustomAttributes (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("storeCustomAttributes") public final Builder storeCustomAttributes(@Nullable Boolean storeCustomAttributes) { this.storeCustomAttributes = storeCustomAttributes; return this; } /** * Initializes the value for the {@link SamlConfiguration#getAddShadowUserOnLogin() addShadowUserOnLogin} attribute. * @param addShadowUserOnLogin The value for addShadowUserOnLogin (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("addShadowUserOnLogin") public final Builder addShadowUserOnLogin(@Nullable Boolean addShadowUserOnLogin) { this.addShadowUserOnLogin = addShadowUserOnLogin; return this; } /** * Initializes the value for the {@link SamlConfiguration#getAssertionConsumerIndex() assertionConsumerIndex} attribute. * @param assertionConsumerIndex The value for assertionConsumerIndex (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("assertionConsumerIndex") public final Builder assertionConsumerIndex(@Nullable Integer assertionConsumerIndex) { this.assertionConsumerIndex = assertionConsumerIndex; return this; } /** * Adds one element to {@link SamlConfiguration#getAuthnContext() authnContext} list. * @param element A authnContext element * @return {@code this} builder for use in a chained invocation */ public final Builder authnContext(String element) { if (this.authnContext == null) { this.authnContext = new ArrayList(); } this.authnContext.add(Objects.requireNonNull(element, "authnContext element")); return this; } /** * Adds elements to {@link SamlConfiguration#getAuthnContext() authnContext} list. * @param elements An array of authnContext elements * @return {@code this} builder for use in a chained invocation */ public final Builder authnContext(String... elements) { if (this.authnContext == null) { this.authnContext = new ArrayList(); } for (String element : elements) { this.authnContext.add(Objects.requireNonNull(element, "authnContext element")); } return this; } /** * Sets or replaces all elements for {@link SamlConfiguration#getAuthnContext() authnContext} list. * @param elements An iterable of authnContext elements * @return {@code this} builder for use in a chained invocation */ @JsonProperty("authnContext") public final Builder authnContext(@Nullable Iterable elements) { if (elements == null) { this.authnContext = null; return this; } this.authnContext = new ArrayList(); return addAllAuthnContext(elements); } /** * Adds elements to {@link SamlConfiguration#getAuthnContext() authnContext} list. * @param elements An iterable of authnContext elements * @return {@code this} builder for use in a chained invocation */ public final Builder addAllAuthnContext(Iterable elements) { Objects.requireNonNull(elements, "authnContext element"); if (this.authnContext == null) { this.authnContext = new ArrayList(); } for (String element : elements) { this.authnContext.add(Objects.requireNonNull(element, "authnContext element")); } return this; } /** * Initializes the value for the {@link SamlConfiguration#getGroupMappingMode() groupMappingMode} attribute. * @param groupMappingMode The value for groupMappingMode (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("groupMappingMode") public final Builder groupMappingMode(@Nullable ExternalGroupMappingMode groupMappingMode) { this.groupMappingMode = groupMappingMode; return this; } /** * Initializes the value for the {@link SamlConfiguration#getIconUrl() iconUrl} attribute. * @param iconUrl The value for iconUrl (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("iconUrl") public final Builder iconUrl(@Nullable String iconUrl) { this.iconUrl = iconUrl; return this; } /** * Initializes the value for the {@link SamlConfiguration#getIdpEntityAlias() idpEntityAlias} attribute. * @param idpEntityAlias The value for idpEntityAlias (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("idpEntityAlias") public final Builder idpEntityAlias(@Nullable String idpEntityAlias) { this.idpEntityAlias = idpEntityAlias; return this; } /** * Initializes the value for the {@link SamlConfiguration#getLinkText() linkText} attribute. * @param linkText The value for linkText (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("linkText") public final Builder linkText(@Nullable String linkText) { this.linkText = linkText; return this; } /** * Initializes the value for the {@link SamlConfiguration#getMetaDataLocation() metaDataLocation} attribute. * @param metaDataLocation The value for metaDataLocation * @return {@code this} builder for use in a chained invocation */ @JsonProperty("metaDataLocation") public final Builder metaDataLocation(String metaDataLocation) { this.metaDataLocation = Objects.requireNonNull(metaDataLocation, "metaDataLocation"); initBits &= ~INIT_BIT_META_DATA_LOCATION; return this; } /** * Initializes the value for the {@link SamlConfiguration#getMetadataTrustCheck() metadataTrustCheck} attribute. * @param metadataTrustCheck The value for metadataTrustCheck (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("metadataTrustCheck") public final Builder metadataTrustCheck(@Nullable Boolean metadataTrustCheck) { this.metadataTrustCheck = metadataTrustCheck; return this; } /** * Initializes the value for the {@link SamlConfiguration#getNameId() nameId} attribute. * @param nameId The value for nameId (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("nameID") public final Builder nameId(@Nullable String nameId) { this.nameId = nameId; return this; } /** * Initializes the value for the {@link SamlConfiguration#getShowSamlLink() showSamlLink} attribute. * @param showSamlLink The value for showSamlLink (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("showSamlLink") public final Builder showSamlLink(@Nullable Boolean showSamlLink) { this.showSamlLink = showSamlLink; return this; } /** * Initializes the value for the {@link SamlConfiguration#getSkipSslValidation() skipSslValidation} attribute. * @param skipSslValidation The value for skipSslValidation (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("skipSslValidation") public final Builder skipSslValidation(@Nullable Boolean skipSslValidation) { this.skipSslValidation = skipSslValidation; return this; } /** * Initializes the value for the {@link SamlConfiguration#getSocketFactoryClassName() socketFactoryClassName} attribute. * @param socketFactoryClassName The value for socketFactoryClassName (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("socketFactoryClassName") public final Builder socketFactoryClassName(@Nullable String socketFactoryClassName) { this.socketFactoryClassName = socketFactoryClassName; return this; } /** * Initializes the value for the {@link SamlConfiguration#getZoneId() zoneId} attribute. * @param zoneId The value for zoneId (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("zoneId") public final Builder zoneId(@Nullable String zoneId) { this.zoneId = zoneId; return this; } /** * Builds a new {@link SamlConfiguration SamlConfiguration}. * @return An immutable instance of SamlConfiguration * @throws java.lang.IllegalStateException if any required attributes are missing */ public SamlConfiguration build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new SamlConfiguration(this); } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if ((initBits & INIT_BIT_META_DATA_LOCATION) != 0) attributes.add("metaDataLocation"); return "Cannot build SamlConfiguration, some of required attributes are not set " + attributes; } } private static List createSafeList(Iterable iterable, boolean checkNulls, boolean skipNulls) { ArrayList list; if (iterable instanceof Collection) { int size = ((Collection) iterable).size(); if (size == 0) return Collections.emptyList(); list = new ArrayList<>(size); } else { list = new ArrayList<>(); } for (T element : iterable) { if (skipNulls && element == null) continue; if (checkNulls) Objects.requireNonNull(element, "element"); list.add(element); } return list; } private static List createUnmodifiableList(boolean clone, List list) { switch(list.size()) { case 0: return Collections.emptyList(); case 1: return Collections.singletonList(list.get(0)); default: if (clone) { return Collections.unmodifiableList(new ArrayList<>(list)); } else { if (list instanceof ArrayList) { ((ArrayList) list).trimToSize(); } return Collections.unmodifiableList(list); } } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy