Search code examples
javaspringazure-active-directoryjwtazure-ad-b2c

How to validate JWT token generated from Azure AD B2C in Java?


I am looking for a code sample in Java to validate the Azure AD B2C token. What are the dependencies we can use? Is JWT token validation steps or code is the same for all the JWT tokens or will it be different? We are not using Spring Security in our project.


Solution

  • There are a ton of libraries here:

    Info. on validating the JWT here.

    Basically, get the key from the https://.../.well-known/openid-configuration endpoint, check the signature, check expiry, check issuer and audience etc.