-
-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow keys with multiple headers on ECDSA signer
More info: #102
- Loading branch information
Showing
6 changed files
with
80 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,6 +249,36 @@ public function verifyShouldReturnTrueWhenKeyIsRight(Token $token) | |
$this->assertTrue($token->verify($this->signer, static::$ecdsaKeys['public1'])); | ||
} | ||
|
||
/** | ||
* @test | ||
* | ||
* @covers Lcobucci\JWT\Builder | ||
* @covers Lcobucci\JWT\Token | ||
* @covers Lcobucci\JWT\Signature | ||
* @covers Lcobucci\JWT\Claim\Factory | ||
* @covers Lcobucci\JWT\Claim\Basic | ||
* @covers Lcobucci\JWT\Parsing\Encoder | ||
* @covers Lcobucci\JWT\Signer\Key | ||
* @covers Lcobucci\JWT\Signer\BaseSigner | ||
* @covers Lcobucci\JWT\Signer\Ecdsa | ||
* @covers Lcobucci\JWT\Signer\Ecdsa\KeyParser | ||
* @covers Lcobucci\JWT\Signer\Ecdsa\Sha256 | ||
*/ | ||
public function everythingShouldWorkWithAKeyWithParams() | ||
{ | ||
$user = (object) ['name' => 'testing', 'email' => '[email protected]']; | ||
|
||
$token = (new Builder())->setId(1) | ||
->setAudience('http://client.abc.com') | ||
->setIssuer('http://api.abc.com') | ||
->set('user', $user) | ||
->setHeader('jki', '1234') | ||
->sign($this->signer, static::$ecdsaKeys['private-params']) | ||
->getToken(); | ||
|
||
$this->assertTrue($token->verify($this->signer, static::$ecdsaKeys['public-params'])); | ||
} | ||
|
||
/** | ||
* @test | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-----BEGIN EC PARAMETERS----- | ||
BggqhkjOPQMBBw== | ||
-----END EC PARAMETERS----- | ||
-----BEGIN EC PRIVATE KEY----- | ||
MHcCAQEEIM6G7WZ6SqoPwrHwGXhOJkYD+ErT8dfRvrNifgBQvSb7oAoGCCqGSM49 | ||
AwEHoUQDQgAE09Hkp/u0tIGdzlQ99R/sXCOr9DTZAfLex4D4Po0C1L3qUqHrzZ0m | ||
B3bAhe+pwEDQ/jqVqdzxhA9i4PqT7F4Aew== | ||
-----END EC PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-----BEGIN PUBLIC KEY----- | ||
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE09Hkp/u0tIGdzlQ99R/sXCOr9DTZ | ||
AfLex4D4Po0C1L3qUqHrzZ0mB3bAhe+pwEDQ/jqVqdzxhA9i4PqT7F4Aew== | ||
-----END PUBLIC KEY----- |