← Back
Editing: AuthPayloadSSLCert.php
<?php namespace GoDaddy\Auth; class AuthPayloadSSLCert extends AuthPayload { /** @var AuthCertSubject */ public $sbj; public function __construct() { $this->sbj = new AuthCertSubject(); } /** * Certificate tokens don't have hbi claim, so always use iat for all security levels. * Certificate tokens expire after 24 hours at all levels (except level 0). * * @param int $level Impact level, 0 to 3. * @param bool $forcedHeartbeat Not used for cert tokens. * @param mixed $reason Expiration reason output parameter. * * @return bool True if the token should be considered expired for the required level. */ public function isExpired(int $level, bool $forcedHeartbeat=false, &$reason=null): bool { $reason = self::EXPIRED_REASON_DEFAULT; // Return false if the level is 0 if ($level === 0) { return false; } // Return true if the level is > 3 if ($level > 3) { return true; } // Get the current time in seconds from UTC time $now = time(); // Certificate tokens always use iat (not hbi) with 24-hour expiration // This prevents HIGH level tokens from being always expired due to hbi defaulting to 0 $expirationSeconds = 60 * 60 * 24; // 24 hours return $now > $this->iat + $expirationSeconds; } }
Save File
Cancel