Skip to content

Commit df9e4d7

Browse files
committed
Updated date method calls.
1 parent bf9c5b3 commit df9e4d7

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class HomeController {
1212
public String home(HttpServletRequest req) {
1313
String requestUrl = getUrl(req);
1414
return "Available commands (assumes httpie - https://github.com/jkbrzt/httpie):\n" +
15-
" http " + requestUrl + "/\n\tThis usage\n" +
15+
" http " + requestUrl + "/\n\tThis usage message\n" +
1616
" http " + requestUrl + "/static-builder\n\tbuild JWT from hardcoded claims\n" +
1717
" http " + requestUrl + "/dynamic-builder-general claim-1=value-1 ... [claim-n=value-n]\n\tbuild JWT from passed in claims (using general claims map)\n" +
1818
" http " + requestUrl + "/dynamic-builder-specific claim-1=value-1 ... [claim-n=value-n]\n\tbuild JWT from passed in claims (using specific claims methods)\n" +

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@
2727
@RestController
2828
public class StaticJWTController {
2929

30-
@RequestMapping(value = "/static-builder", method = POST)
30+
@RequestMapping(value = "/static-builder", method = GET)
3131
public String fixedBuilder() throws UnsupportedEncodingException {
3232

3333
String jws = Jwts.builder()
34+
.setIssuer("Stormpath")
3435
.setSubject("msilverman")
35-
.setExpiration(Date.from(Instant.now().plus(1, ChronoUnit.DAYS)))
3636
.claim("name", "Micah Silverman")
3737
.claim("scope", "admins")
38+
.setIssuedAt(Date.from(Instant.ofEpochSecond(1466796822))) // Fri Jun 24 2016 15:33:42 GMT-0400 (EDT)
39+
.setExpiration(Date.from(Instant.ofEpochSecond(1466883222))) // Sat Jun 25 2016 15:33:42 GMT-0400 (EDT)
3840
.signWith(
3941
SignatureAlgorithm.HS256,
4042
"secret".getBytes("UTF-8")

0 commit comments

Comments
 (0)