Updated date method calls.
This commit is contained in:
parent
bf9c5b3c91
commit
df9e4d7ef5
|
@ -12,7 +12,7 @@ public class HomeController {
|
|||
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\n" +
|
||||
" http " + requestUrl + "/\n\tThis usage message\n" +
|
||||
" http " + requestUrl + "/static-builder\n\tbuild JWT from hardcoded claims\n" +
|
||||
" 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" +
|
||||
" 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" +
|
||||
|
|
|
@ -27,14 +27,16 @@ import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
|||
@RestController
|
||||
public class StaticJWTController {
|
||||
|
||||
@RequestMapping(value = "/static-builder", method = POST)
|
||||
@RequestMapping(value = "/static-builder", method = GET)
|
||||
public String fixedBuilder() throws UnsupportedEncodingException {
|
||||
|
||||
String jws = Jwts.builder()
|
||||
.setIssuer("Stormpath")
|
||||
.setSubject("msilverman")
|
||||
.setExpiration(Date.from(Instant.now().plus(1, ChronoUnit.DAYS)))
|
||||
.claim("name", "Micah Silverman")
|
||||
.claim("scope", "admins")
|
||||
.setIssuedAt(Date.from(Instant.ofEpochSecond(1466796822))) // Fri Jun 24 2016 15:33:42 GMT-0400 (EDT)
|
||||
.setExpiration(Date.from(Instant.ofEpochSecond(1466883222))) // Sat Jun 25 2016 15:33:42 GMT-0400 (EDT)
|
||||
.signWith(
|
||||
SignatureAlgorithm.HS256,
|
||||
"secret".getBytes("UTF-8")
|
||||
|
|
Loading…
Reference in New Issue