Last active
March 31, 2018 12:52
-
-
Save drissamri/82dc691dacf0bcc0beda996acb02decf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@Bean | |
public JwtParser jwtParser() | |
{ | |
Security.addProvider(new BouncyCastleProvider()); | |
final X509EncodedKeySpec spec = new X509EncodedKeySpec(Base64.getUrlDecoder().decode(PUBLIC_KEY)); | |
final KeyFactory factory; | |
try { | |
factory = KeyFactory.getInstance("ECDSA", "BC"); | |
final PublicKey publicKey = factory.generatePublic(spec); | |
return Jwts.parser().setSigningKey(publicKey); | |
} | |
catch (NoSuchAlgorithmException | NoSuchProviderException | InvalidKeySpecException e) { | |
throw new RuntimeException(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment