diff --git a/README.md b/README.md index 0ecec9e2..e323d1d7 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Test](https://img.shields.io/github/workflow/status/alancting/php-microsoft-jwt/PHP%20Test?label=TEST&style=for-the-badge)](https://github.com/alancting/php-microsoft-jwt) [![Coverage Status](https://img.shields.io/coveralls/github/alancting/php-microsoft-jwt/master?style=for-the-badge)](https://coveralls.io/github/alancting/php-microsoft-jwt?branch=master) [![GitHub license](https://img.shields.io/github/license/alancting/php-microsoft-jwt?color=green&style=for-the-badge)](https://github.com/alancting/php-microsoft-jwt/blob/master/LICENCE) -[![firebase/php-jwt Version](https://img.shields.io/static/v1?label=firebase%2Fphp-jwt&message=5.2.0&color=blue&style=for-the-badge)](https://github.com/firebase/php-jwt/tree/v5.2.0) +[![firebase/php-jwt Version](https://img.shields.io/static/v1?label=firebase%2Fphp-jwt&message=5.2.1&color=blue&style=for-the-badge)](https://github.com/firebase/php-jwt/tree/v5.2.1) # php-microsoft-jwt diff --git a/composer.json b/composer.json index 6dcd63c9..dddeee90 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "ad", "microsoft" ], - "version": "1.1.0", + "version": "1.2.0", "authors": [ { "name": "Neuman Vong", diff --git a/src/JWK.php b/src/JWK.php index f22b32f3..f19b1d2d 100644 --- a/src/JWK.php +++ b/src/JWK.php @@ -3,8 +3,8 @@ namespace Alancting\Microsoft\JWT; use DomainException; -use UnexpectedValueException; use InvalidArgumentException; +use UnexpectedValueException; /** * JSON Web Key implementation, based on this spec: diff --git a/src/JWT.php b/src/JWT.php index 12ce024c..f8665133 100644 --- a/src/JWT.php +++ b/src/JWT.php @@ -2,10 +2,10 @@ namespace Alancting\Microsoft\JWT; -use \DomainException; -use \InvalidArgumentException; -use \UnexpectedValueException; -use \DateTime; +use DomainException; +use InvalidArgumentException; +use UnexpectedValueException; +use DateTime; /** * JSON Web Token implementation, based on this spec: @@ -66,6 +66,7 @@ class JWT * * @return object The JWT's payload as a PHP object * + * @throws InvalidArgumentException Provided JWT was empty * @throws UnexpectedValueException Provided JWT was invalid * @throws SignatureInvalidException Provided JWT was invalid because the signature verification failed * @throws BeforeValidException Provided JWT is trying to be used before it's eligible as defined by 'nbf' diff --git a/tests/JWKTest.php b/tests/JWKTest.php index 872455f1..100b3f0f 100644 --- a/tests/JWKTest.php +++ b/tests/JWKTest.php @@ -47,6 +47,20 @@ public function testParseJwkKeySet() self::$keys = $keys; } + public function testParseJwkKey_empty() + { + $this->setExpectedException('InvalidArgumentException', 'JWK must not be empty'); + + JWK::parseKeySet(array('keys' => array(array()))); + } + + public function testParseJwkKeySet_empty() + { + $this->setExpectedException('InvalidArgumentException', 'JWK Set did not contain any keys'); + + JWK::parseKeySet(array('keys' => array())); + } + /** * @depends testParseJwkKeySet */