Class HardcodedKeyLocator

java.lang.Object
org.keycloak.rotation.HardcodedKeyLocator
All Implemented Interfaces:
Iterable<Key>, KeyLocator

public class HardcodedKeyLocator extends Object implements KeyLocator, Iterable<Key>
Key locator for a bunch of keys. It can be initializaed with or without key names.
Author:
Hynek Mlnařík
  • Constructor Details

    • HardcodedKeyLocator

      public HardcodedKeyLocator(Key key)
    • HardcodedKeyLocator

      public HardcodedKeyLocator(Collection<? extends Key> keys)
    • HardcodedKeyLocator

      public HardcodedKeyLocator(Map<String,? extends Key> keys)
  • Method Details

    • getKey

      public Key getKey(String kid)
      Description copied from interface: KeyLocator
      Returns a key with a particular ID.
      Specified by:
      getKey in interface KeyLocator
      Parameters:
      kid - Key ID
      Returns:
      key, which should be used for verify signature on given "input"
    • getKey

      public Key getKey(Key key)
      Description copied from interface: KeyLocator
      Method that checks if the key passed is inside the locator.
      Specified by:
      getKey in interface KeyLocator
      Parameters:
      key - The key to search
      Returns:
      The same key or null if it's not in the locator
    • refreshKeyCache

      public void refreshKeyCache()
      Description copied from interface: KeyLocator
      If this key locator caches keys in any way, forces this cache cleanup and refreshing the keys.
      Specified by:
      refreshKeyCache in interface KeyLocator
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • iterator

      public Iterator<Key> iterator()
      Specified by:
      iterator in interface Iterable<Key>