Skip to content

Instantly share code, notes, and snippets.

@claytantor
Created November 7, 2016 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save claytantor/18597b606ef10f80728baa7ee458ed23 to your computer and use it in GitHub Desktop.
Save claytantor/18597b606ef10f80728baa7ee458ed23 to your computer and use it in GitHub Desktop.
getting okta key with nimbus
/**
Okta provides the kid field in the header part of the JWT token.
**/
PublicKey loadKey(String keyId) {
try {
JSONObject key = getProviderRSAJWK(
retrieveOIDCProviderMetadata().getJWKSetURI().toURL().openStream(),
keyId);
return RSAKey.parse(key).toRSAPublicKey();
} catch (Exception e) {
throw new RuntimeException("Unable to retrieve public key with id "+ keyId, e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment