validateExpIatAuthTime property

Future<bool> get validateExpIatAuthTime

Validates exp, iat, and auth_time claims using the current accurate time. The exp claim must be in the future, while iat and auth_time must be in the past.

Implementation

Future<bool> get validateExpIatAuthTime async {
  final now = await AccurateTime.now(isUtc: true);

  final validateExp = _isClaimDateValid(exp, now);
  final validateIat = _isClaimDateValid(iat, now, mustBePast: true);
  final validateAuthTime = _isClaimDateValid(authTime, now, mustBePast: true);

  if (!validateExp) log('Token expired');
  if (!validateIat) log('Token issued in the future');
  if (!validateAuthTime) log('Token issued before authentication');

  return validateExp && validateIat && validateAuthTime;
}