File tree Expand file tree Collapse file tree 2 files changed +487
-5
lines changed
Expand file tree Collapse file tree 2 files changed +487
-5
lines changed Original file line number Diff line number Diff line change @@ -243,7 +243,8 @@ public final class LoginManager: @unchecked Sendable /* Sendable is ensured by t
243243 token. IDToken!,
244244 providerMetadata: providerMetadata,
245245 process: process,
246- userID: profile? . userID
246+ userID: profile? . userID,
247+ currentDate: Date ( )
247248 )
248249 }
249250
@@ -404,7 +405,10 @@ extension LoginManager {
404405 func verifyIDToken(
405406 _ token: JWT ,
406407 providerMetadata: DiscoveryDocument . ResolvedProviderMetadata ,
407- process: LoginProcess , userID: String ? ) throws
408+ process: LoginProcess ,
409+ userID: String ? ,
410+ currentDate: Date = Date ( )
411+ ) throws
408412 {
409413
410414 try token. verify ( with: providerMetadata. jwk)
@@ -417,10 +421,9 @@ extension LoginManager {
417421 }
418422 try payload. verify ( keyPath: \. audience, expected: process. configuration. channelID)
419423
420- let now = Date ( )
421424 let allowedClockSkew : TimeInterval = 5 * 60
422- try payload. verify ( keyPath: \. expiration, laterThan: now . addingTimeInterval ( - allowedClockSkew) )
423- try payload. verify ( keyPath: \. issueAt, earlierThan: now . addingTimeInterval ( allowedClockSkew) )
425+ try payload. verify ( keyPath: \. expiration, laterThan: currentDate . addingTimeInterval ( - allowedClockSkew) )
426+ try payload. verify ( keyPath: \. issueAt, earlierThan: currentDate . addingTimeInterval ( allowedClockSkew) )
424427 try payload. verify ( keyPath: \. nonce, expected: process. IDTokenNonce!)
425428 }
426429}
You can’t perform that action at this time.
0 commit comments