Skip to content
Snippets Groups Projects
Commit 3bed0bd5 authored by L. Ellenbeck's avatar L. Ellenbeck
Browse files

set clock skew to 0 (Issue/1964-tokenExpiryUIv2)

parent 71cc0726
No related branches found
No related tags found
1 merge request!14Fix: JWT token now uses UTC and not local time
Pipeline #661320 passed
......@@ -15,8 +15,10 @@ namespace Coscine.JwtHandler
private readonly JwtSecurityTokenHandler _jwtSecurityTokenHandler;
private readonly SymmetricSecurityKey _symmetricSecurityKey;
private readonly DateTime _centuryBegin;
// How long the default token is valid (in minutes).
private readonly double _defaultExpiration;
private readonly string _issuer;
private readonly string _audience;
......@@ -52,7 +54,9 @@ namespace Coscine.JwtHandler
ValidateIssuerSigningKey = true,
IssuerSigningKey = _symmetricSecurityKey,
ValidateIssuer = false,
ValidateAudience = false
ValidateAudience = false,
// set clockskew to zero so tokens expire exactly at token expiration time (instead of 5 minutes later)
ClockSkew = TimeSpan.Zero
};
_jwtSecurityTokenHandler.ValidateToken(token, tokenValidationParameters, out _);
......@@ -107,6 +111,5 @@ namespace Coscine.JwtHandler
return GenerateJwtToken(payload, issuer, audience, issuedAt, expires, signatureAlgorithm);
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment