Skip to content

Instantly share code, notes, and snippets.

@salgmachine
salgmachine / OAuth2AuthorizationServerConfigJwt.java
Last active March 20, 2024 19:56
JWE/JWT with Spring Boot 2 and Nimbus JOSE JWT
// this is based on code from https://www.baeldung.com/spring-security-oauth-jwt
// also based on code from https://connect2id.com/products/nimbus-jose-jwt/examples/signed-and-encrypted-jwt and https://connect2id.com/products/nimbus-jose-jwt/examples/jwt-with-rsa-encryption
// used com.nimbusds:nimbus-jose-jwt:6.4.2
// interesting bits at lines 120 - 188
/**
* THIS IS JUST A PROOF OF CONCEPT. DO NOT USE IN PRODUCTION.
*/
import java.text.ParseException;
import java.util.Arrays;