Skip to content

Commit 532437a

Browse files
committed
Added README.
1 parent 50509bf commit 532437a

2 files changed

Lines changed: 52 additions & 7 deletions

File tree

‎jjwt/README.md‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## JWT Fun
2+
3+
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.
4+
5+
### Build and Run
6+
7+
It's super easy to build and exercise this tutorial.
8+
9+
```
10+
mvn clean install
11+
java -jar target/*.jar
12+
```
13+
14+
That's it!
15+
16+
You can hit the home endpoint with your favorite command-line http client. My favorite is: [httpie](https://github.com/jkbrzt/httpie)
17+
18+
`http localhost:8080`
19+
20+
```
21+
Available commands (assumes httpie - https://github.com/jkbrzt/httpie):
22+
23+
http http://localhost:8080/
24+
This usage message
25+
26+
http http://localhost:8080/static-builder
27+
build JWT from hardcoded claims
28+
29+
http POST http://localhost:8080/dynamic-builder-general claim-1=value-1 ... [claim-n=value-n]
30+
build JWT from passed in claims (using general claims map)
31+
32+
http POST http://localhost:8080/dynamic-builder-specific claim-1=value-1 ... [claim-n=value-n]
33+
build JWT from passed in claims (using specific claims methods)
34+
35+
http POST http://localhost:8080/dynamic-builder-compress claim-1=value-1 ... [claim-n=value-n]
36+
build DEFLATE compressed JWT from passed in claims
37+
38+
http http://localhost:8080/parser?jwt=<jwt>
39+
Parse passed in JWT
40+
41+
http http://localhost:8080/parser-enforce?jwt=<jwt>
42+
Parse passed in JWT enforcing the 'iss' registered claim and the 'hasMotorcycle' custom claim
43+
```
44+
45+
The Baeldung post that compliments this repo can be found [here](http://www.baeldung.com/)

‎jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller/HomeController.java‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ public class HomeController {
1111
@RequestMapping("/")
1212
public String home(HttpServletRequest req) {
1313
String requestUrl = getUrl(req);
14-
return "Available commands (assumes httpie - https://github.com/jkbrzt/httpie):\n" +
15-
" http " + requestUrl + "/\n\tThis usage message\n" +
16-
" http " + requestUrl + "/static-builder\n\tbuild JWT from hardcoded claims\n" +
17-
" 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" +
18-
" 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" +
19-
" http POST " + requestUrl + "/dynamic-builder-compress claim-1=value-1 ... [claim-n=value-n]\n\tbuild DEFLATE compressed JWT from passed in claims\n" +
20-
" http " + requestUrl + "/parser?jwt=<jwt>\n\tParse passed in JWT\n" +
14+
return "Available commands (assumes httpie - https://github.com/jkbrzt/httpie):\n\n" +
15+
" http " + requestUrl + "/\n\tThis usage message\n\n" +
16+
" http " + requestUrl + "/static-builder\n\tbuild JWT from hardcoded claims\n\n" +
17+
" 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" +
18+
" 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" +
19+
" 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" +
20+
" http " + requestUrl + "/parser?jwt=<jwt>\n\tParse passed in JWT\n\n" +
2121
" http " + requestUrl + "/parser-enforce?jwt=<jwt>\n\tParse passed in JWT enforcing the 'iss' registered claim and the 'hasMotorcycle' custom claim\n";
2222
}
2323

0 commit comments

Comments
 (0)