Interface AuthSettings


public interface AuthSettings
A read-only view of the configuration the resolution chain consults.

It exists as an interface rather than a Properties for one concrete reason: some callers hold a credential that is not IN their properties file. The crypto CLI, for instance, stores its client secret encrypted and decrypts it in memory; handing the chain a properties object would force either a plaintext write or a special case in the chain for one caller. With this interface the caller supplies what it has, however it obtained it, and the chain stays ignorant of where anything came from.

Precedence

An explicitly supplied value wins, then a properties entry, then the environment. The environment is last so that a file written on purpose is not overridden by an ambient variable somebody exported for something else - and first-from-the-bottom is still enough for a container or a pod spec to configure a workload whose code names nothing.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Assembles an immutable AuthSettings.
  • Method Summary

    Modifier and Type
    Method
    Description
    A builder for callers that hold some values in hand - a decrypted secret, a token they were given - and want the rest resolved from properties and the environment.
    default boolean
    Whether a setting is configured, WITHOUT producing its value.
    of(Properties properties)
    Settings backed by a properties object with the process environment as fallback.
    Returns a setting whose value is a credential, wrapped so the caller can close it.
    value(AuthSetting setting)
    Returns the configured value of a setting.
  • Method Details

    • value

      Optional<String> value(AuthSetting setting)
      Returns the configured value of a setting.
      Parameters:
      setting - the setting to read; must not be null
      Returns:
      the value, absent when unset or blank
    • isPresent

      default boolean isPresent(AuthSetting setting)
      Whether a setting is configured, WITHOUT producing its value.

      Presence and value are different questions and must stay separable. "Which credential does this deployment use?" is asked by status commands, health checks and the chain itself; it has to be answerable from configuration alone, cheaply and without side effects. Answering it by fetching the value would mean a caller merely INSPECTING a configuration had to be able to decrypt a stored secret - so a store that is present but unreadable would crash the status command instead of being reported by it, which is exactly backwards.

      Parameters:
      setting - the setting to test; must not be null
      Returns:
      true when a value is configured
    • secret

      default Optional<SecretChars> secret(AuthSetting setting)
      Returns a setting whose value is a credential, wrapped so the caller can close it.

      The default derives it from value(AuthSetting); an implementation holding real secret material overrides this and never lets it become a String at all.

      Parameters:
      setting - the setting to read; must not be null
      Returns:
      the credential, absent when unset. The caller owns and closes what it receives.
    • of

      static AuthSettings of(Properties properties)
      Settings backed by a properties object with the process environment as fallback.
      Parameters:
      properties - the properties; must not be null
      Returns:
      the settings view
    • builder

      static AuthSettings.Builder builder()
      A builder for callers that hold some values in hand - a decrypted secret, a token they were given - and want the rest resolved from properties and the environment.
      Returns:
      a new builder