Package org.keycloak.rotation
Interface KeyLocator
-
- All Known Implementing Classes:
CompositeKeyLocator,HardcodedKeyLocator
public interface KeyLocator extends Iterable<Key>
This interface defines a method for obtaining a security key by ID.If the
KeyLocatorimplementor wants to make all its keys available for iteration, it should implementIterable<T extendsKey> interface. The baseKeyLocatordoes not extend this interface to enableKeyLocatorsthat do not support listing their keys.- Author:
- Hynek Mlnařík
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classKeyLocator.KeyHashHelper class that facilitates the hash of a Key to be located easier.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description KeygetKey(String kid)Returns a key with a particular ID.default KeygetKey(Key key)Method that checks if the key passed is inside the locator.default KeygetKey(KeyInfo info)Returns the key in the locator that is represented by the KeyInfo dsig structure.voidrefreshKeyCache()If this key locator caches keys in any way, forces this cache cleanup and refreshing the keys.-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
getKey
Key getKey(String kid) throws KeyManagementException
Returns a key with a particular ID.- Parameters:
kid- Key ID- Returns:
- key, which should be used for verify signature on given "input"
- Throws:
KeyManagementException
-
getKey
default Key getKey(Key key) throws KeyManagementException
Method that checks if the key passed is inside the locator.- Parameters:
key- The key to search- Returns:
- The same key or null if it's not in the locator
- Throws:
KeyManagementException
-
getKey
default Key getKey(KeyInfo info) throws KeyManagementException
Returns the key in the locator that is represented by the KeyInfo dsig structure. The default implementation just iterates and returns the first KeyName, X509Data or PublicKey that is in the locator.- Parameters:
info- The KeyInfo to search- Returns:
- The key found or null
- Throws:
KeyManagementException
-
refreshKeyCache
void refreshKeyCache()
If this key locator caches keys in any way, forces this cache cleanup and refreshing the keys.
-
-