Package org.wildfly.security.http.oidc
Class JWKPublicKeyLocator
- java.lang.Object
-
- org.wildfly.security.http.oidc.JWKPublicKeyLocator
-
- All Implemented Interfaces:
PublicKeyLocator
class JWKPublicKeyLocator extends Object implements PublicKeyLocator
A public key locator that dynamically obtains the public key from an OpenID provider by sending a request to the provider'sjwks_uri
when needed.- Author:
- Marek Posolda, Farah Juma
-
-
Field Summary
Fields Modifier and Type Field Description private Map<String,PublicKey>
currentKeys
private int
lastRequestTime
-
Constructor Summary
Constructors Constructor Description JWKPublicKeyLocator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
getCurrentTime()
PublicKey
getPublicKey(String kid, OidcClientConfiguration oidcClientConfiguration)
private PublicKey
lookupCachedKey(int publicKeyCacheTtl, int currentTime, String kid)
void
reset(OidcClientConfiguration oidcClientConfiguration)
Reset the state of locator (eg.private void
sendRequest(OidcClientConfiguration oidcClientConfiguration)
-
-
-
Method Detail
-
getPublicKey
public PublicKey getPublicKey(String kid, OidcClientConfiguration oidcClientConfiguration)
- Specified by:
getPublicKey
in interfacePublicKeyLocator
- Parameters:
kid
- the key idoidcClientConfiguration
- the OpenID Connect client configuration- Returns:
- the public key for the OpenID provider
-
reset
public void reset(OidcClientConfiguration oidcClientConfiguration)
Description copied from interface:PublicKeyLocator
Reset the state of locator (eg. clear the cached keys)- Specified by:
reset
in interfacePublicKeyLocator
- Parameters:
oidcClientConfiguration
- the OpenID Connect client configuration
-
lookupCachedKey
private PublicKey lookupCachedKey(int publicKeyCacheTtl, int currentTime, String kid)
-
sendRequest
private void sendRequest(OidcClientConfiguration oidcClientConfiguration)
-
getCurrentTime
private static int getCurrentTime()
-
-