Skip to content
This repository was archived by the owner on Oct 14, 2021. It is now read-only.

Commit 1653580

Browse files
authored
Fix exp claim validation (#33)
1 parent 07b5e99 commit 1653580

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dotnet/dotnetframework/GeneXusJWT/JWTClaims/RegisteredClaim.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ public static bool validateClaim(string registeredClaimKey, string registeredCla
117117

118118
if (registeredClaimCustomTime != 0)
119119
{
120-
newTime = (Int32)(DateTime.UtcNow.AddSeconds(registeredClaimCustomTime).Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
120+
newTime = (Int32)(DateTime.UtcNow.AddSeconds(-1*registeredClaimCustomTime).Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
121121
}
122122
else
123123
{
124124
newTime = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
125125
}
126-
return (Int32)exp <= newTime;
126+
return (Int32)exp >= newTime;
127127
case RegisteredClaim.sub:
128128
return SecurityUtils.compareStrings(token.Payload.Sub, registeredClaimValue);
129129
case RegisteredClaim.aud:

0 commit comments

Comments
 (0)