java - How can I reset the JWT token expiration time? -
i have created jwt token along expiration time authentication purpose. each time when url hits in application checking token. want increase jwt token expiration time. following how done. token expiring taking expiration time set while creating token.
//creating jwt token once when user logged in string jwttoken = new string(jwts.builder().setsubject(user.getuserid()) .setexpiration(exptime).setissuedat(new date()) .signwith(signaturealgorithm.hs256, "secretkey").compact()); // checking presence of token every time claims claims = jwts.parser().setsigningkey("secretkey") .parseclaimsjws(jwttoken).getbody(); claims.setexpiration(time); // trying reset expiration time don't know what's going wrong. appreciated.
i think expiration time part of token , it's not possible extend expiration time of token without new one.
please refer jwt (json web token) automatic prolongation of expiration more discussion this.
Comments
Post a Comment