Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src/main update MicroProfile JWT Auth code Sep 6, 2019
.gitignore add mp jwt example Aug 10, 2019
Dockerfile update mp jwt example Aug 10, 2019
README.md update MicroProfile JWT Auth code Sep 6, 2019
buildAndRun.bat update package name Aug 17, 2019
buildAndRun.sh update package name Aug 17, 2019
jwtenizr.jar add mp jwt example Aug 10, 2019
pom.xml update package name Aug 17, 2019
server.xml update mp jwt example Aug 10, 2019

README.md

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

You can’t perform that action at this time.