Filter Checking the JSON Web Token
The magic hides behind JsonTokenNeeded. Well, not really, it hides behind the BearerTokenFilter. JsonTokenNeeded is just a JAX-RS name binding (think of it as a CDI interceptor binding), so it’s just an annotation that binds to a filter.
1 - Gets the HTTP Authorization header from the request and checks for the JSON Web Token (the Bearer string)
Install dependencies:
$ mvn clean install
Start the server:
$ mvn tomcat8:run
http://localhost:8081/api