Class PlatformKeyringFactory

java.lang.Object
org.tentackle.keyring.DefaultKeyringFactory
org.tentackle.keyring.platform.PlatformKeyringFactory
All Implemented Interfaces:
KeyringFactory

@Service(KeyringFactory.class) public class PlatformKeyringFactory extends DefaultKeyringFactory
The keyring factory for the credential store of the operating system.

Replaces the DefaultKeyringFactory of Tentackle core as soon as this module is part of the application. Picks the keyring as follows:

  1. the keyring named by the system property "tentackle.keyring", if set,
  2. the credential store of the operating system, if usable,
  3. the fallbacks of the DefaultKeyringFactory.
Falling back is logged as a warning, since the secrets are then either not protected or not remembered.
  • Constructor Details

    • PlatformKeyringFactory

      public PlatformKeyringFactory()
      Creates the factory.
  • Method Details

    • selectBestKeyring

      protected Keyring selectBestKeyring()
      Selects the best keyring available.

      Overridden by factories providing more secure keyrings, which fall back to this implementation if theirs is not usable.

      Returns the credential store of the operating system, if usable. Otherwise, logs a warning and falls back to the keyrings of the DefaultKeyringFactory.

      Overrides:
      selectBestKeyring in class DefaultKeyringFactory
      Returns:
      the keyring
    • createKeyring

      protected AbstractKeyring createKeyring(String name)
      Creates a keyring by its name.

      Overridden by factories providing more keyrings.

      Adds the keyrings of the operating systems.

      Overrides:
      createKeyring in class DefaultKeyringFactory
      Parameters:
      name - the keyring's name
      Returns:
      the keyring
    • getPlatformKeyringName

      protected String getPlatformKeyringName()
      Gets the name of the keyring for the current operating system.
      Returns:
      the keyring name