-
-
Notifications
You must be signed in to change notification settings - Fork 614
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
244 additions
and
25 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
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,28 @@ | ||
<?php | ||
|
||
namespace Lexik\Bundle\JWTAuthenticationBundle\Event; | ||
|
||
use Lexik\Bundle\JWTAuthenticationBundle\Exception\ExpiredTokenException; | ||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
/** | ||
* JWTExpiredEvent. | ||
* | ||
* @author Robin Chalas <robin.chalas@gmail.com> | ||
*/ | ||
class JWTExpiredEvent extends AuthenticationFailureEvent implements JWTFailureEventInterface | ||
{ | ||
/** | ||
* @param ExpiredTokenException $exception | ||
* @param Response $response | ||
*/ | ||
public function __construct(ExpiredTokenException $exception, Response $response) | ||
{ | ||
parent::__construct($exception, $response); | ||
} | ||
|
||
public function getInvalidPayload() | ||
{ | ||
return $this->exception->getPayload(); | ||
} | ||
} |
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,46 @@ | ||
<?php | ||
|
||
namespace Lexik\Bundle\JWTAuthenticationBundle\Exception; | ||
|
||
use Lexik\Bundle\JWTAuthenticationBundle\Security\Guard\JWTTokenAuthenticator; | ||
use Symfony\Component\Security\Core\Exception\AuthenticationException; | ||
|
||
/** | ||
* Exception that should be thrown from a {@link JWTTokenAuthenticator} implementation during | ||
* an authentication process.. | ||
* | ||
* @author Robin Chalas <robin.chalas@gmail.com> | ||
*/ | ||
class ExpiredTokenException extends AuthenticationException | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
private $payload; | ||
|
||
/** | ||
* @param array $payload The invalidated payload | ||
*/ | ||
public function __construct(array $payload) | ||
{ | ||
parent::__construct(); | ||
|
||
$this->payload = $payload; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getPayload() | ||
{ | ||
return $this->payload; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMessageKey() | ||
{ | ||
return 'Expired JWT Token'; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Lexik\Bundle\JWTAuthenticationBundle\Exception; | ||
|
||
/** | ||
* JWTExpirationTimeReachedException should be thrown from an encoder when the decoded | ||
* token is expired, catchable during an authentication process. | ||
* | ||
* @author Robin Chalas <robin.chalas@gmail.com> | ||
*/ | ||
class JWTExpirationTimeReachedException extends JWTDecodeFailureException | ||
{ | ||
/** | ||
* @param array $invalidPayload The payload in which the exp time is reached | ||
*/ | ||
public function __construct(array $invalidPayload) | ||
{ | ||
$this->invalidPayload = $invalidPayload; | ||
|
||
parent::__construct('Expired JWT Token'); | ||
} | ||
|
||
/** | ||
* Gets the payload of the expired token. This can be useful | ||
* to reuse the user informations, for automatically providing | ||
* a new token for instance. | ||
* | ||
* @return array | ||
*/ | ||
public function getInvalidPayload() | ||
{ | ||
return $this->invalidPayload; | ||
} | ||
} |
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
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
Oops, something went wrong.