Class SecureSetting<T>

java.lang.Object
org.elasticsearch.common.settings.Setting<T>
org.elasticsearch.common.settings.SecureSetting<T>
All Implemented Interfaces:
org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject

public abstract class SecureSetting<T> extends Setting<T>
A secure setting. This class allows access to settings from the Elasticsearch keystore.
  • Method Details

    • getDefaultRaw

      public String getDefaultRaw(Settings settings)
      Description copied from class: Setting
      Returns the default value string representation for this setting.
      Overrides:
      getDefaultRaw in class Setting<T>
      Parameters:
      settings - a settings object for settings that has a default value depending on another setting if available
    • getDefault

      public T getDefault(Settings settings)
      Description copied from class: Setting
      Returns the default value for this setting.
      Overrides:
      getDefault in class Setting<T>
      Parameters:
      settings - a settings object for settings that has a default value depending on another setting if available
    • exists

      public boolean exists(Settings settings)
      Description copied from class: Setting
      Returns true if and only if this setting is present in the given settings instance. Note that fallback settings are excluded.
      Overrides:
      exists in class Setting<T>
      Parameters:
      settings - the settings
      Returns:
      true if the setting is present in the given settings instance, otherwise false
    • get

      public T get(Settings settings)
      Description copied from class: Setting
      Returns the settings value. If the setting is not present in the given settings object the default value is returned instead.
      Overrides:
      get in class Setting<T>
    • getSecretDigest

      public byte[] getSecretDigest(Settings settings)
      Returns the digest of this secure setting's value or null if the setting is missing (inside the keystore). This method can be called even after the SecureSettings have been closed, unlike #get(Settings). The digest is used to check for changes of the value (by re-reading the SecureSettings), without actually transmitting the value to compare with.
    • diff

      public void diff(Settings.Builder builder, Settings source, Settings defaultSettings)
      Overrides the diff operation to make this a no-op for secure settings as they shouldn't be returned in a diff
      Overrides:
      diff in class Setting<T>
      Parameters:
      builder - the settings builder to fill the diff into
      source - the source settings object to diff
      defaultSettings - the default settings object to diff against
    • secureString

      public static Setting<SecureString> secureString(String name, Setting<SecureString> fallback, Setting.Property... properties)
      A setting which contains a sensitive string. This may be any sensitive string, e.g. a username, a password, an auth token, etc.
    • secureFile

      public static Setting<InputStream> secureFile(String name, Setting<InputStream> fallback, Setting.Property... properties)
      A setting which contains a file. Reading the setting opens an input stream to the file. This may be any sensitive file, e.g. a set of credentials normally in plaintext.