java.lang.IllegalStateException: JWTAuthContextInfo has not been initialized. Please make sure that either ‘mp.jwt.verify.publickey’ or ‘mp.jwt.verify.publickey.location’ properties are set

It is quite evident from the exception (java.lang.IllegalStateException: JWTAuthContextInfo has not been initialized) that your are missing following key properties inside your application.properties

1mp.jwt.verify.publickey.location

or

1mp.jwt.verify.publickey


Resolution

Step 1 : Define mp.jwt.verify.publickey.location

To fix this issue you need to define mp.jwt.verify.publickey.location inside of your application.properties

1mp.jwt.verify.publickey.location=keystore/keystore.jks


Step 2 : Generate self signed certificate

Use the JDK keystore utility to generate a self signed certificate

1keytool -genkey -keyalg RSA -alias quarkusdemo -keystore keystore.jks -storepass mypassword -validity 365 -keysize 2048

Above command will generate "keystore.jks".

Store "keystore.jks" at - resources/keystore/keystore.jks

java.lang.IllegalStateException: JWTAuthContextInfo has not been initialized. Please make sure that either 'mp.jwt.verify.publickey' or 'mp.jwt.verify.publickey.location' properties are set

After this you are good to go and hopefully your exception will go away.

You can cloned this repo from GitHub

Learn more about Quarkus - Getting Started with Quarkus