File tree Expand file tree Collapse file tree
jjwt/src/main/java/io/jsonwebtoken/jjwtfun/controller Expand file tree Collapse file tree Original file line number Diff line number Diff 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 \t This usage\n " +
15+ " http " + requestUrl + "/\n \t This usage message \n " +
1616 " http " + requestUrl + "/static-builder\n \t build JWT from hardcoded claims\n " +
1717 " http " + requestUrl + "/dynamic-builder-general claim-1=value-1 ... [claim-n=value-n]\n \t build 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 \t build JWT from passed in claims (using specific claims methods)\n " +
Original file line number Diff line number Diff line change 2727@ RestController
2828public 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" )
You can’t perform that action at this time.
0 commit comments