Skip to content

Commit 9eedd12

Browse files
authored
Update jwt library (#30)
* Updated web-token jwt lib dependency * Updated JsonWebKeySetService * Updated to PHP 7.2
1 parent 4baeb0a commit 9eedd12

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: php
22

33
php:
4-
- '7.1'
4+
- '7.2'
55

66
sudo: false
77

@@ -24,4 +24,4 @@ script:
2424
- ./vendor/bin/phpcov merge --clover build/logs/clover.xml build/cov
2525

2626
after_success:
27-
- travis_retry php vendor/bin/php-coveralls
27+
- travis_retry php vendor/bin/php-coveralls

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
}
1818
],
1919
"require": {
20-
"php": ">=7.1.0",
20+
"php": ">=7.2.0",
2121
"ext-openssl": "*",
2222
"league/oauth2-server": "^7.0",
2323
"nette/forms": "^2.4",
2424
"psr/container": "^1.0",
2525
"simplesamlphp/composer-module-installer": "^1.0",
26-
"spomky-labs/jose": "^7.0",
26+
"web-token/jwt-framework": "^2.1",
2727
"steverhoades/oauth2-openid-connect-server": "^1.0",
2828
"zendframework/zend-diactoros": "^1.3"
2929
},

lib/Services/JsonWebKeySetService.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
namespace SimpleSAML\Modules\OpenIDConnect\Services;
1616

17-
use Jose\Factory\JWKFactory;
18-
use Jose\Object\JWKSet;
17+
use Jose\Component\Core\JWKSet;
18+
use Jose\Component\KeyManagement\JWKFactory;
1919
use SimpleSAML\Error\Exception;
2020
use SimpleSAML\Utils\Config;
2121

@@ -40,12 +40,11 @@ public function __construct()
4040
'alg' => 'RS256',
4141
]);
4242

43-
$this->jwkSet = new JWKSet();
44-
$this->jwkSet->addKey($jwk);
43+
$this->jwkSet = new JWKSet([$jwk]);
4544
}
4645

4746
public function keys()
4847
{
49-
return $this->jwkSet->getKeys();
48+
return $this->jwkSet->all();
5049
}
5150
}

tests/Services/JsonWebKeySetServiceTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414

1515
namespace Tests\SimpleSAML\Modules\OpenIDConnect\Services;
1616

17-
use Jose\Factory\JWKFactory;
18-
use Jose\Object\JWKSet;
17+
use Jose\Component\Core\JWKSet;
18+
use Jose\Component\KeyManagement\JWKFactory;
1919
use PHPUnit\Framework\TestCase;
2020
use SimpleSAML\Configuration;
21-
use SimpleSAML\Error\Exception;
2221
use SimpleSAML\Modules\OpenIDConnect\Services\JsonWebKeySetService;
2322

2423
class JsonWebKeySetServiceTest extends TestCase
@@ -66,16 +65,15 @@ public function testKeys()
6665
'use' => 'sig',
6766
'alg' => 'RS256',
6867
]);
69-
$JWKSet = new JWKSet();
70-
$JWKSet->addKey($jwk);
68+
$JWKSet = new JWKSet([$jwk]);
7169

7270
$jsonWebKeySetService = new JsonWebKeySetService();
7371

74-
$this->assertEquals($JWKSet->getKeys(), $jsonWebKeySetService->keys());
72+
$this->assertEquals($JWKSet->all(), $jsonWebKeySetService->keys());
7573
}
7674

7775
/**
78-
* @expectedException Exception
76+
* @expectedException \Exception
7977
*/
8078
public function testCertificationFileNotFound()
8179
{

0 commit comments

Comments
 (0)