-
-
Notifications
You must be signed in to change notification settings - Fork 600
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating leeway to just use int (and update tests), updated documenta…
…tion, fixed styling issue
- Loading branch information
Showing
5 changed files
with
207 additions
and
249 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -31,14 +31,14 @@ class UnsignedTokenTest extends \PHPUnit_Framework_TestCase | |
*/ | ||
public function builderCanGenerateAToken() | ||
{ | ||
$user = (object)['name' => 'testing', 'email' => '[email protected]']; | ||
$user = (object) ['name' => 'testing', 'email' => '[email protected]']; | ||
|
||
$token = (new Builder())->setId(1) | ||
->setAudience('http://client.abc.com') | ||
->setIssuer('http://api.abc.com') | ||
->setExpiration(self::CURRENT_TIME + 3000) | ||
->set('user', $user) | ||
->getToken(); | ||
->setAudience('http://client.abc.com') | ||
->setIssuer('http://api.abc.com') | ||
->setExpiration(self::CURRENT_TIME + 3000) | ||
->set('user', $user) | ||
->getToken(); | ||
|
||
$this->assertAttributeEquals(null, 'signature', $token); | ||
$this->assertEquals('http://client.abc.com', $token->getClaim('aud')); | ||
|
@@ -54,17 +54,17 @@ public function builderCanGenerateAToken() | |
* | ||
* @depends builderCanGenerateAToken | ||
* | ||
* @covers Lcobucci\JWT\Builder | ||
* @covers Lcobucci\JWT\Parser | ||
* @covers Lcobucci\JWT\Token | ||
* @covers Lcobucci\JWT\Claim\Factory | ||
* @covers Lcobucci\JWT\Claim\Basic | ||
* @covers Lcobucci\JWT\Parsing\Encoder | ||
* @covers Lcobucci\JWT\Parsing\Decoder | ||
* @covers Lcobucci\JWT\Builder | ||
* @covers Lcobucci\JWT\Parser | ||
* @covers Lcobucci\JWT\Token | ||
* @covers Lcobucci\JWT\Claim\Factory | ||
* @covers Lcobucci\JWT\Claim\Basic | ||
* @covers Lcobucci\JWT\Parsing\Encoder | ||
* @covers Lcobucci\JWT\Parsing\Decoder | ||
*/ | ||
public function parserCanReadAToken(Token $generated) | ||
{ | ||
$read = (new Parser())->parse((string)$generated); | ||
$read = (new Parser())->parse((string) $generated); | ||
|
||
$this->assertEquals($generated, $read); | ||
$this->assertEquals('testing', $read->getClaim('user')->name); | ||
|
@@ -75,16 +75,16 @@ public function parserCanReadAToken(Token $generated) | |
* | ||
* @depends builderCanGenerateAToken | ||
* | ||
* @covers Lcobucci\JWT\Builder | ||
* @covers Lcobucci\JWT\Parser | ||
* @covers Lcobucci\JWT\Token | ||
* @covers Lcobucci\JWT\ValidationData | ||
* @covers Lcobucci\JWT\Claim\Factory | ||
* @covers Lcobucci\JWT\Claim\Basic | ||
* @covers Lcobucci\JWT\Claim\EqualsTo | ||
* @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo | ||
* @covers Lcobucci\JWT\Parsing\Encoder | ||
* @covers Lcobucci\JWT\Parsing\Decoder | ||
* @covers Lcobucci\JWT\Builder | ||
* @covers Lcobucci\JWT\Parser | ||
* @covers Lcobucci\JWT\Token | ||
* @covers Lcobucci\JWT\ValidationData | ||
* @covers Lcobucci\JWT\Claim\Factory | ||
* @covers Lcobucci\JWT\Claim\Basic | ||
* @covers Lcobucci\JWT\Claim\EqualsTo | ||
* @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo | ||
* @covers Lcobucci\JWT\Parsing\Encoder | ||
* @covers Lcobucci\JWT\Parsing\Decoder | ||
*/ | ||
public function tokenValidationShouldReturnWhenEverythingIsFine(Token $generated) | ||
{ | ||
|
@@ -100,18 +100,18 @@ public function tokenValidationShouldReturnWhenEverythingIsFine(Token $generated | |
* | ||
* @dataProvider invalidValidationData | ||
* | ||
* @depends builderCanGenerateAToken | ||
* @depends builderCanGenerateAToken | ||
* | ||
* @covers Lcobucci\JWT\Builder | ||
* @covers Lcobucci\JWT\Parser | ||
* @covers Lcobucci\JWT\Token | ||
* @covers Lcobucci\JWT\ValidationData | ||
* @covers Lcobucci\JWT\Claim\Factory | ||
* @covers Lcobucci\JWT\Claim\Basic | ||
* @covers Lcobucci\JWT\Claim\EqualsTo | ||
* @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo | ||
* @covers Lcobucci\JWT\Parsing\Encoder | ||
* @covers Lcobucci\JWT\Parsing\Decoder | ||
* @covers Lcobucci\JWT\Builder | ||
* @covers Lcobucci\JWT\Parser | ||
* @covers Lcobucci\JWT\Token | ||
* @covers Lcobucci\JWT\ValidationData | ||
* @covers Lcobucci\JWT\Claim\Factory | ||
* @covers Lcobucci\JWT\Claim\Basic | ||
* @covers Lcobucci\JWT\Claim\EqualsTo | ||
* @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo | ||
* @covers Lcobucci\JWT\Parsing\Encoder | ||
* @covers Lcobucci\JWT\Parsing\Decoder | ||
*/ | ||
public function tokenValidationShouldReturnFalseWhenExpectedDataDontMatch(ValidationData $data, Token $generated) | ||
{ | ||
|
@@ -123,20 +123,20 @@ public function tokenValidationShouldReturnFalseWhenExpectedDataDontMatch(Valida | |
* | ||
* @depends builderCanGenerateAToken | ||
* | ||
* @covers Lcobucci\JWT\Builder | ||
* @covers Lcobucci\JWT\Parser | ||
* @covers Lcobucci\JWT\Token | ||
* @covers Lcobucci\JWT\ValidationData | ||
* @covers Lcobucci\JWT\Claim\Factory | ||
* @covers Lcobucci\JWT\Claim\Basic | ||
* @covers Lcobucci\JWT\Claim\EqualsTo | ||
* @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo | ||
* @covers Lcobucci\JWT\Parsing\Encoder | ||
* @covers Lcobucci\JWT\Parsing\Decoder | ||
* @covers Lcobucci\JWT\Builder | ||
* @covers Lcobucci\JWT\Parser | ||
* @covers Lcobucci\JWT\Token | ||
* @covers Lcobucci\JWT\ValidationData | ||
* @covers Lcobucci\JWT\Claim\Factory | ||
* @covers Lcobucci\JWT\Claim\Basic | ||
* @covers Lcobucci\JWT\Claim\EqualsTo | ||
* @covers Lcobucci\JWT\Claim\GreaterOrEqualsTo | ||
* @covers Lcobucci\JWT\Parsing\Encoder | ||
* @covers Lcobucci\JWT\Parsing\Decoder | ||
*/ | ||
public function tokenValidationShouldReturnTrueWhenExpectedDataMatchBecauseOfLeeway(Token $generated) | ||
{ | ||
$notExpiredDueToLeeway = new ValidationData(self::CURRENT_TIME + 3020, ['exp' => -50]); | ||
$notExpiredDueToLeeway = new ValidationData(self::CURRENT_TIME + 3020, 50); | ||
$notExpiredDueToLeeway->setAudience('http://client.abc.com'); | ||
$notExpiredDueToLeeway->setIssuer('http://api.abc.com'); | ||
$this->assertTrue($generated->validate($notExpiredDueToLeeway)); | ||
|
Oops, something went wrong.