-
-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security] Deprecate current system in favor of a JWTTokenAuthenticat…
…or (Guard) (#184) | Q | A | |---------------|------| | Bug fix? | no | | New feature? | yes | | BC breaks? | no | | Deprecations | yes | | Fixed tickets | ~ | | Tests pass? | yes | See #132 discussion. @slashfan after you started to work on, I made some changes. I'm really not an expert in the Guard component itself, but it seems make our life easier from all sides. --- - [x] Add the Guard JWTAuthenticator - [x] Test it - [x] Add a full functional test case - [x] Depreciate old security system - [x] Update the documentation
- v3.1.1
- v3.1.0
- v3.0.0
- v2.21.0
- v2.20.3
- v2.20.2
- v2.20.1
- v2.20.0
- v2.19.1
- v2.19.0
- v2.18.1
- v2.18.0
- v2.17.0
- v2.16.0
- v2.15.1
- v2.15.0
- v2.14.4
- v2.14.3
- v2.14.2
- v2.14.1
- v2.14.0
- v2.13.0
- v2.12.6
- v2.12.5
- v2.12.4
- v2.12.3
- v2.12.2
- v2.12.1
- v2.12.0
- v2.11.3
- v2.11.2
- v2.11.1
- v2.11.0
- v2.10.7
- v2.10.6
- v2.10.5
- v2.10.4
- v2.10.3
- v2.10.2
- v2.10.1
- v2.10.0
- v2.9.0
- v2.8.0
- v2.7.0
- v2.6.5
- v2.6.4
- v2.6.3
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.4
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
Showing
55 changed files
with
1,879 additions
and
221 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,12 @@ | ||
<?php | ||
|
||
namespace Lexik\Bundle\JWTAuthenticationBundle\Event; | ||
|
||
/** | ||
* JWTExpiredEvent. | ||
* | ||
* @author Robin Chalas <robin.chalas@gmail.com> | ||
*/ | ||
class JWTExpiredEvent extends AuthenticationFailureEvent implements JWTFailureEventInterface | ||
{ | ||
} |
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,23 @@ | ||
<?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 | ||
{ | ||
/** | ||
* {@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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Lexik\Bundle\JWTAuthenticationBundle\Exception; | ||
|
||
use Symfony\Component\Security\Core\Exception\AuthenticationException; | ||
|
||
/** | ||
* Missing key in the token payload during authentication. | ||
* | ||
* @author Robin Chalas <robin.chalas@gmail.com> | ||
*/ | ||
class InvalidPayloadException extends AuthenticationException | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $invalidKey; | ||
|
||
/** | ||
* @param string $invalidKey The key that cannot be found in the payload | ||
*/ | ||
public function __construct($invalidKey) | ||
{ | ||
$this->invalidKey = $invalidKey; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMessageKey() | ||
{ | ||
return sprintf('Unable to find key "%s" in the token payload.', $this->invalidKey); | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace Lexik\Bundle\JWTAuthenticationBundle\Exception; | ||
|
||
use Symfony\Component\Security\Core\Exception\AuthenticationException; | ||
|
||
/** | ||
* Exception to be thrown in case of invalid token during an authentication process. | ||
* | ||
* @author Robin Chalas <robin.chalas@gmail.com> | ||
*/ | ||
class InvalidTokenException extends AuthenticationException | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMessageKey() | ||
{ | ||
return 'Invalid 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
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,21 @@ | ||
<?php | ||
|
||
namespace Lexik\Bundle\JWTAuthenticationBundle\Exception; | ||
|
||
use Symfony\Component\Security\Core\Exception\AuthenticationException; | ||
|
||
/** | ||
* Exception to be thrown in case of invalid token during an authentication process. | ||
* | ||
* @author Robin Chalas <robin.chalas@gmail.com> | ||
*/ | ||
class MissingTokenException extends AuthenticationException | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMessageKey() | ||
{ | ||
return 'JWT Token not found'; | ||
} | ||
} |
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,41 @@ | ||
<?php | ||
|
||
namespace Lexik\Bundle\JWTAuthenticationBundle\Exception; | ||
|
||
use Symfony\Component\Security\Core\Exception\AuthenticationException; | ||
|
||
/** | ||
* User not found during authentication. | ||
* | ||
* @author Robin Chalas <robin.chalas@gmail.com> | ||
*/ | ||
class UserNotFoundException extends AuthenticationException | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $userIdentityField; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $identity; | ||
|
||
/** | ||
* @param string $userIdentityField | ||
* @param string $identity | ||
*/ | ||
public function __construct($userIdentityField, $identity) | ||
{ | ||
$this->userIdentityField = $userIdentityField; | ||
$this->identity = $identity; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMessageKey() | ||
{ | ||
return sprintf('Unable to load an user with property "%s" = "%s". If the user identity has changed, you must renew the token. Otherwise, verify that the "lexik_jwt_authentication.user_identity_field" config option is correctly set.', $this->userIdentityField, $this->identity); | ||
} | ||
} |
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.