Skip to content

Latest commit

 

History

History

microprofile-jwt-auth

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

MicroProfile JWT Auth

Steps to run this project

  1. Run java -jar jwtenizr.jar
  2. Adjust the created jwt-token.json like the following:
{
  "iss": "rieckpil",
  "jti": "42",
  "sub": "duke",
  "upn": "duke",
  "groups": [
    "chief",
    "hacker",
    "admin"
  ],
  "administrator_id": 42,
  "administrator_level": "HIGH"
}
  1. Re-run java -jar jwtenizr.jar
  2. Take the public key from the generated microprofile-config.properties file and paste it to src/main/resources/META-INF/publicKey.pem in the inner section, e.g.:
-----BEGIN RSA PUBLIC KEY-----
MydoO3l7rOiRw5PMtlxHYRqK51eql2pVvp+lASalwIDAQAB
-----END RSA PUBLIC KEY-----
  1. Start the application with ./buildAndRun.sh or buildAndRun.bat
  2. Use the cURL console output of the last run of jwtenizr and adjust the port and URL path, e.g.:
curl -i -H'Authorization: Bearer eyXYZ' http://localhost:9080/resources/books

or use Postman and take the JWT from the generated token.jwt file