Added README.

This commit is contained in:
Micah Silverman 2016-06-27 23:34:01 -04:00
parent 50509bf42b
commit 532437ae46
2 changed files with 52 additions and 7 deletions

45
jjwt/README.md Normal file
View File

@ -0,0 +1,45 @@
## JWT Fun
This tutorial walks you through the various features supported by the [JJWT](https://github.com/jwtk/jjwt) library - a fluent interface Java JWT building and parsing library.
### Build and Run
It's super easy to build and exercise this tutorial.
```
mvn clean install
java -jar target/*.jar
```
That's it!
You can hit the home endpoint with your favorite command-line http client. My favorite is: [httpie](https://github.com/jkbrzt/httpie)
`http localhost:8080`
```
Available commands (assumes httpie - https://github.com/jkbrzt/httpie):
http http://localhost:8080/
This usage message
http http://localhost:8080/static-builder
build JWT from hardcoded claims
http POST http://localhost:8080/dynamic-builder-general claim-1=value-1 ... [claim-n=value-n]
build JWT from passed in claims (using general claims map)
http POST http://localhost:8080/dynamic-builder-specific claim-1=value-1 ... [claim-n=value-n]
build JWT from passed in claims (using specific claims methods)
http POST http://localhost:8080/dynamic-builder-compress claim-1=value-1 ... [claim-n=value-n]
build DEFLATE compressed JWT from passed in claims
http http://localhost:8080/parser?jwt=<jwt>
Parse passed in JWT
http http://localhost:8080/parser-enforce?jwt=<jwt>
Parse passed in JWT enforcing the 'iss' registered claim and the 'hasMotorcycle' custom claim
```
The Baeldung post that compliments this repo can be found [here](http://www.baeldung.com/)

View File

@ -11,13 +11,13 @@ public class HomeController {
@RequestMapping("/")
public String home(HttpServletRequest req) {
String requestUrl = getUrl(req);
return "Available commands (assumes httpie - https://github.com/jkbrzt/httpie):\n" +
" http " + requestUrl + "/\n\tThis usage message\n" +
" http " + requestUrl + "/static-builder\n\tbuild JWT from hardcoded claims\n" +
" http POST " + requestUrl + "/dynamic-builder-general claim-1=value-1 ... [claim-n=value-n]\n\tbuild JWT from passed in claims (using general claims map)\n" +
" http POST " + requestUrl + "/dynamic-builder-specific claim-1=value-1 ... [claim-n=value-n]\n\tbuild JWT from passed in claims (using specific claims methods)\n" +
" http POST " + requestUrl + "/dynamic-builder-compress claim-1=value-1 ... [claim-n=value-n]\n\tbuild DEFLATE compressed JWT from passed in claims\n" +
" http " + requestUrl + "/parser?jwt=<jwt>\n\tParse passed in JWT\n" +
return "Available commands (assumes httpie - https://github.com/jkbrzt/httpie):\n\n" +
" http " + requestUrl + "/\n\tThis usage message\n\n" +
" http " + requestUrl + "/static-builder\n\tbuild JWT from hardcoded claims\n\n" +
" http POST " + requestUrl + "/dynamic-builder-general claim-1=value-1 ... [claim-n=value-n]\n\tbuild JWT from passed in claims (using general claims map)\n\n" +
" http POST " + requestUrl + "/dynamic-builder-specific claim-1=value-1 ... [claim-n=value-n]\n\tbuild JWT from passed in claims (using specific claims methods)\n\n" +
" http POST " + requestUrl + "/dynamic-builder-compress claim-1=value-1 ... [claim-n=value-n]\n\tbuild DEFLATE compressed JWT from passed in claims\n\n" +
" http " + requestUrl + "/parser?jwt=<jwt>\n\tParse passed in JWT\n\n" +
" http " + requestUrl + "/parser-enforce?jwt=<jwt>\n\tParse passed in JWT enforcing the 'iss' registered claim and the 'hasMotorcycle' custom claim\n";
}