Interface ServerConfigStorageProvider

All Superinterfaces:
org.keycloak.provider.Provider

public interface ServerConfigStorageProvider extends org.keycloak.provider.Provider
A Provider to store server configuration to be shared between the Keycloak instances.

This provider is a key-value store where both keys and values are String.

  • Method Summary

    Modifier and Type
    Method
    Description
    find(String key)
    Returns the value to which the specified key.
     
    default String
    loadOrCreate(String key, String value)
    Same as loadOrCreate(key, () -> value).
    loadOrCreate(String key, Supplier<String> valueGenerator)
    Returns the value to which the specified key or, if not found, stores the value returned by the valueGenerator.
    void
    Removes the value specified by the key.
    default boolean
    replace(String key, String expected, String newValue)
    Same as replace(key, Objects.requireNonNull(expected)::equals, () -> Objects.requireNonNull(newValue)).
    boolean
    replace(String key, Predicate<String> replacePredicate, Supplier<String> valueGenerator)
    Replaces the value specified by key if the Predicate return a true value.
    void
    store(String key, String value)
    Stores the specified value with the specified key.

    Methods inherited from interface org.keycloak.provider.Provider

    close
  • Method Details

    • find

      Optional<String> find(String key)
      Returns the value to which the specified key.
      Parameters:
      key - The key whose associated value is to be returned.
      Returns:
      The value from the specified key.
      Throws:
      NullPointerException - if the specified key is null.
    • store

      void store(String key, String value)
      Stores the specified value with the specified key.

      If the key exists, its value is updated.

      Parameters:
      key - The key with which the specified value is to be stored.
      value - The value to be associated with the specified key.
      Throws:
      NullPointerException - if the specified key or value is null.
    • remove

      void remove(String key)
      Removes the value specified by the key.
      Parameters:
      key - The key whose value is to be removed.
      Throws:
      NullPointerException - if the specified key is null.
    • loadOrCreate

      String loadOrCreate(String key, Supplier<String> valueGenerator)
      Returns the value to which the specified key or, if not found, stores the value returned by the valueGenerator.
      Parameters:
      key - The key whose associated value is to be returned or stored.
      valueGenerator - The Supplier to generate the value if it is not found.
      Returns:
      The {value stored by the key, or the value generated by the Supplier.
      Throws:
      NullPointerException - if the specified key, valueGenerator or Supplier return value is null.
    • loadOrCreate

      default String loadOrCreate(String key, String value)
      Same as loadOrCreate(key, () -> value).
      See Also:
    • replace

      default boolean replace(String key, String expected, String newValue)
      Same as replace(key, Objects.requireNonNull(expected)::equals, () -> Objects.requireNonNull(newValue)).
      See Also:
    • replace

      boolean replace(String key, Predicate<String> replacePredicate, Supplier<String> valueGenerator)
      Replaces the value specified by key if the Predicate return a true value.
      Parameters:
      key - The key whose associated value is to be replaced.
      replacePredicate - The Predicate to signal if the value should be replaced.
      valueGenerator - The Supplier to generate the value if it is should be replaced.
      Returns:
      true if the value is replaced, and false otherwise.
    • keys

      Stream<String> keys()
      Returns:
      a Stream of all keys currently stored.