Created
November 7, 2016 19:26
-
-
Save claytantor/18597b606ef10f80728baa7ee458ed23 to your computer and use it in GitHub Desktop.
getting okta key with nimbus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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