Class EphemeralKeyProvider
java.lang.Object
org.apache.juneau.rest.server.mcp.v20260728.EphemeralKeyProvider
- All Implemented Interfaces:
KeyProvider
Built-in default
KeyProvider: a random AES-256 key with a random keyId, both fixed for the
lifetime of the instance.
Not restart-durable and not shareable across process instances by design — mirrors
AeadRequestStateCodec's pre-KeyProvider ephemeral-key behavior exactly, including the
cross-instance-unseal-fails guarantee (see AeadRequestStateCodec_Test's a06), just relocated
one layer down. Operators who need cross-restart or multi-instance RESUME must supply StaticKeyProvider
(or a custom KeyProvider) instead of relying on this default.
- Since:
- 10.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe key to seal new tokens with, together with its identifier.resolveKey(String keyId) Resolves akeyIdseen on an incoming token to the key that sealed it.
-
Constructor Details
-
EphemeralKeyProvider
public EphemeralKeyProvider()Constructor. Generates a fresh, per-instance AES-256 key and a fresh, per-instance randomkeyId.
-
-
Method Details
-
currentKey
Description copied from interface:KeyProviderThe key to seal new tokens with, together with its identifier.May return a different value over time — a changing return value is the sanctioned mechanism for live runtime key rotation in a custom provider. Built-in providers (
EphemeralKeyProvider,StaticKeyProvider) return a fixed value for the lifetime of the instance.- Specified by:
currentKeyin interfaceKeyProvider- Returns:
- The current sealing key. Never
null .
-
resolveKey
Description copied from interface:KeyProviderResolves akeyIdseen on an incoming token to the key that sealed it.- Specified by:
resolveKeyin interfaceKeyProvider- Parameters:
keyId- The key identifier read from the untrusted, client-supplied token, before decryption. Nevernull .- Returns:
- The resolved key, or
Optional.empty()ifkeyIdis unknown or retired. Never throws.
-