You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello guys, ggs by the way for the stable release of v5 o/
I saw your new version of handling validation of JWT tokens, so i checked a bit of it and changed my code to call ->validate() from the Token like this
$now = (new \DateTimeImmutable())->getTimestamp();
$oValidator = (new \Phalcon\Encryption\Security\JWT\Validator($this->oToken, 100))
->validateIssuedAt($now)
->validateIssuer($this->oConfig->application->baseUri)
->validateAudience($this->oConfig->application->baseUri)
->validateExpiration($now)
->validateSignature(newHmac('sha256'), $signerKey ?: $this->oConfig->security->cryptKey)
->validateId($id);
$this->oToken->validate($oValidator);
And i got this RuntimeException 'Call to undefined method Phalcon\Encryption\Security\JWT\Validator::aud()'
After checking the source code in Encryption/Security/JWT/Token/Token.zep, I might see the error but never programmed in Zephir,
the way you loop into the array of [method => claimId], didn't you invert claimId and method in the for..in ?
It would call validator->Enum::AUDIENCE instead of validator->validateAudience()
I might have seen another 'bug' in the validationExpiration() from the Validator, the validationExpiration(timestamp) method would add now an error if timestamp is before the timestamp in exp claim, if I set the timestamp after the exp claim, i got no error.
$oToken = (new \Phalcon\Encryption\Security\JWT\Builder(newHmac('sha256')))
->setIssuer('test')
->setAudience('test')
->setExpirationTime(strtotime('+100 seconds'))
->setPassphrase($this->di->getConfig()->security->cryptKey)
->getToken();
$oValidator = (new \Phalcon\Encryption\Security\JWT\Validator($oToken))
->validateExpiration((strtotime('now')));
// Validation: the token has expiredprint_r($oValidator->getErrors());
$oValidator = (new \Phalcon\Encryption\Security\JWT\Validator($oToken))
->validateExpiration((strtotime('+101 seconds')));
// empty arrayprint_r($oValidator->getErrors());
Phalcon5.0.0
PHP8.1
Debian 11
Thanks again o/
The text was updated successfully, but these errors were encountered:
Hello guys, ggs by the way for the stable release of v5 o/
I saw your new version of handling validation of JWT tokens, so i checked a bit of it and changed my code to call ->validate() from the Token like this
And i got this RuntimeException 'Call to undefined method Phalcon\Encryption\Security\JWT\Validator::aud()'
After checking the source code in Encryption/Security/JWT/Token/Token.zep, I might see the error but never programmed in Zephir,
the way you loop into the array of [method => claimId], didn't you invert claimId and method in the for..in ?
It would call validator->Enum::AUDIENCE instead of validator->validateAudience()
I might have seen another 'bug' in the validationExpiration() from the Validator, the validationExpiration(timestamp) method would add now an error if timestamp is before the timestamp in exp claim, if I set the timestamp after the exp claim, i got no error.
Thanks again o/
The text was updated successfully, but these errors were encountered: