Skip to content

Commit

Permalink
auth_time date
Browse files Browse the repository at this point in the history
  • Loading branch information
luisrudge committed Oct 24, 2019
1 parent a31d462 commit 1eb123a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,15 @@ export const verify = (options: JWTVerifyOptions) => {
);
}

const leeway = options.leeway || 60;
const now = new Date();
const expDate = new Date(0);
const iatDate = new Date(0);
const nbfDate = new Date(0);
const leeway = options.leeway || 60;
const authTimeDate = new Date(
parseInt(decoded.claims.auth_time) + parseInt(options.max_age) + leeway
const authTimeDate = new Date(0);
authTimeDate.setUTCSeconds(
(parseInt(decoded.claims.auth_time) + parseInt(options.max_age)) / 1000 +
leeway
);
expDate.setUTCSeconds(decoded.claims.exp + leeway);
iatDate.setUTCSeconds(decoded.claims.iat - leeway);
Expand Down

0 comments on commit 1eb123a

Please sign in to comment.