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_uriwhen needed.- Author:
- Marek Posolda, Farah Juma
-
-
Field Summary
Fields Modifier and Type Field Description private Map<String,PublicKey>currentKeysprivate intlastRequestTime
-
Constructor Summary
Constructors Constructor Description JWKPublicKeyLocator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static intgetCurrentTime()PublicKeygetPublicKey(String kid, OidcClientConfiguration oidcClientConfiguration)private PublicKeylookupCachedKey(int publicKeyCacheTtl, int currentTime, String kid)voidreset(OidcClientConfiguration oidcClientConfiguration)Reset the state of locator (eg.private voidsendRequest(OidcClientConfiguration oidcClientConfiguration)
-
-
-
Method Detail
-
getPublicKey
public PublicKey getPublicKey(String kid, OidcClientConfiguration oidcClientConfiguration)
- Specified by:
getPublicKeyin 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:PublicKeyLocatorReset the state of locator (eg. clear the cached keys)- Specified by:
resetin 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()
-
-