Skip to content

Commit

Permalink
jwt: Handle the verification of the expiration claim properly
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonycastelli committed Apr 27, 2017
1 parent c94bcdf commit 14d2ece
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/App/Models/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extension User {

// Verify the token
try receivedJWT.verifySignature(using: HS256(key: Authentication.AccessTokenSigningKey.makeBytes()))
if receivedJWT.verifyClaims([ExpirationTimeClaim(Date() + Authentication.Length)]) {
if receivedJWT.verifyClaims([ExpirationTimeClaim(Date())]) {
guard let userId = receivedJWT.payload.object?[SubjectClaim.name]?.string else { throw IncorrectCredentialsError() }
user = try User.query().filter("id", userId).first()
} else {
Expand Down

0 comments on commit 14d2ece

Please sign in to comment.