Changeset 14331
- Timestamp:
- 01/03/2025 01:58:57 PM (15 months ago)
- Location:
- sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/adhocore-php-jwt
- Files:
-
- 2 edited
-
JWT.php (modified) (3 diffs)
-
ValidatesJWT.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/adhocore-php-jwt/JWT.php
r9564 r14331 144 144 * 145 145 * @param string $token 146 * @param bool $verify 146 147 * 147 148 * @throws JWTException … … 149 150 * @return array 150 151 */ 151 public function decode(string $token ): array152 public function decode(string $token, bool $verify = true): array 152 153 { 153 154 if (\substr_count($token, '.') < 2) { … … 156 157 157 158 $token = \explode('.', $token, 3); 159 if (!$verify) { 160 return (array) $this->urlSafeDecode($token[1]); 161 } 162 158 163 $this->validateHeader((array) $this->urlSafeDecode($token[0])); 159 164 -
sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/adhocore-php-jwt/ValidatesJWT.php
r14329 r14331 87 87 ['exp', $this->leeway /* */ , static::ERROR_TOKEN_EXPIRED, 'Expired'], 88 88 ['iat', $this->maxAge - $this->leeway, static::ERROR_TOKEN_EXPIRED, 'Expired'], 89 ['nbf', $this->maxAge -$this->leeway, static::ERROR_TOKEN_NOT_NOW, 'Not now'],89 ['nbf', -$this->leeway, static::ERROR_TOKEN_NOT_NOW, 'Not now'], 90 90 ]; 91 91 … … 115 115 } 116 116 117 if ($this->key===false) { 117 if (\PHP_VERSION_ID < 80000 && !\is_resource($this->key)) { 118 throw new JWTException('Invalid key: Should be resource of private key', static::ERROR_KEY_INVALID); 119 } 120 121 if (\PHP_VERSION_ID > 80000 && !( 122 $this->key instanceof \OpenSSLAsymmetricKey 123 || $this->key instanceof \OpenSSLCertificate 124 || $this->key instanceof \OpenSSLCertificateSigningRequest 125 )) { 118 126 throw new JWTException('Invalid key: Should be resource of private key', static::ERROR_KEY_INVALID); 119 127 }
Note: See TracChangeset
for help on using the changeset viewer.