We are starting to use the oauth2 libraries to execute an AUTH Code flow, retrieve the access_token, and validate the JWT signature. So far, the auth code flow works great. We have a simple POC setup to 'protect' a resource like seen in many examples. I am able to retrieve the JSON from the principal.
principal = {
"access_token" : "eyJhbGciOiJSUzUxMiJ9.eyJpcsIn0RemovedCharactersToShorten.iuBODHxV0o2nBCvTsJSwkkkJYxxi2X0qFOCtznBJqSRO6uxU0J3Yjy_INw8xVHelxrWKurE5D_Cy23bnKRl-adSuoCJfGRq5SFF7B2BHvmJ4fxhy1scpA0CCKEzknCBWDcYzKJDzmrv2ZeA17DGhAAXsFFuY33Rlzj7duyu9AfK-1i65oZeBDw1e72a0Y7eifcZCueRI2NHR-gvwNYr4shhdEzgyifgcCThmb_HjaBAi5ydKgqngfuHzQ1twwD87Lc9le_7i_e1yt3oc4SXuhiWLbqLfjB0E2_j_RxhYp448DiDfbXM7KJDDzsxjJOW2X2qrIV1ksF-mDEsJq7AuO20M-eTuRvSDXdrra_W5S6VG-yJsKl1z77rVKZWaf9DwFjgE1RNuPDkHnBpRmMyKPlhF124WkYqOf4H1Jif_2v2U8bY41x6pjhWNGUGpbd2xMAsZMVra8iXseN3fKKHqaD57eWX8XGjFxkadvGAo5V-cIBzPgf4ZFSXpX90fGgxl3MC2_PXgV4Fzf4GD6RfJ96zhfaqK-tNsgIlE4w8qzlkgf70ueAn3wkq4qz4PERuixhLnkuXBLjkQgOUGVo_-gbBuoSah_ctE-5SvGFI4e2h4VcAv3dyuzscWMTyAMoz1k_twLPVBHahBqkflEEcQ2Y6AxrR-4Mfwlnr_mn7FCCM",
"expires_in" : 300,
"refresh_token" : "RB10724B10CDA423192C39038086AB20D",
"token_type" : "Bearer",
"expires_at" : 1549467771152
}
How do we now convert the access_token into a validated JWT? Is that done through OAuth2Auth and decodeToken (which seems to be deprecated) or should we use JWTAuth? Ideally, I'd like to leverage the "jwks_uri" defined in our /.well-known/openid-configuration to avoid dealing with keystores and whatnot.
Any tips, suggestions, or references to Java examples using well-known configuration to validate a JWT would be greatly appreciated. I've spent hours looking at examples and trying different things with keys, urls, etc. but I'm coming up short.
Thanks,
Jerry