Running the samples

The samples we looked at can be deployed to Thorntail and accessed via command-line queries against the endpoints to validate the expected behaviors. Since authentication against the endpoints marked with security constraints requires a valid JWT, we need a way to generate a JWT that will be accepted by the Thorntail server.

This chapter's code provides an io.packt.jwt.test.GenerateToken utility that will create a JWT signed by a key that has been configured with the Thorntail server. The claims included in the JWT are defined by the src/test/resources/JwtClaims.json document of this chapter's project. You run the utility using the mvn exec:java command, as shown here:

Scotts-iMacPro:jwtprop starksm$ mvn exec:java -Dexec.mainClass=io.packt.jwt.test.GenerateToken ...

Get Hands-On Enterprise Java Microservices with Eclipse MicroProfile now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.