-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CHANGE: Add refresh-failed/refresh succeeded events in case authentication fails CHANGE: Add domain specific exceptions
- Loading branch information
Showing
27 changed files
with
1,291 additions
and
1,133 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
/var | ||
*.cache | ||
/vendor-bin/**/vendor | ||
/vendor-bin/**/composer.lock binary | ||
.idea/ |
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
<?xml version="1.0"?> | ||
<psalm | ||
resolveFromConfigFile="true" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="https://getpsalm.org/schema/config" | ||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor-bin/static/vendor/vimeo/psalm/config.xsd" | ||
memoizeMethodCallResults="true" | ||
totallyTyped="true" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="https://getpsalm.org/schema/config" | ||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor-bin/static/vendor/vimeo/psalm/config.xsd" | ||
errorLevel="1" | ||
> | ||
<projectFiles> | ||
<directory name="src"/> | ||
<ignoreFiles> | ||
<file name="src/DependencyInjection/BundleConfiguration.php"/> | ||
<file name="vendor/bin/psalm"/> | ||
<directory name="vendor"/> | ||
</ignoreFiles> | ||
</projectFiles> | ||
</psalm> |
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,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yivoff\JwtRefreshBundle\Event; | ||
|
||
use Yivoff\JwtRefreshBundle\Exception\FailType; | ||
|
||
class JwtRefreshTokenFailed | ||
{ | ||
public function __construct(public readonly FailType $failType, public readonly ?string $tokenId, public readonly ?string $userIdentifier) | ||
{ | ||
} | ||
} |
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 | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yivoff\JwtRefreshBundle\Event; | ||
|
||
class JwtRefreshTokenSuccess | ||
{ | ||
public function __construct(public readonly string $tokenId, public readonly string $userIdentifier) | ||
{ | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yivoff\JwtRefreshBundle\Exception; | ||
|
||
enum FailType: string | ||
{ | ||
case PAYLOAD = 'Invalid Payload'; | ||
|
||
case INVALID = 'Invalid Token'; | ||
|
||
case EXPIRED = 'Expired Token'; | ||
|
||
case NOT_FOUND = '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,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yivoff\JwtRefreshBundle\Exception; | ||
|
||
use Exception; | ||
use Symfony\Component\Security\Core\Exception\AuthenticationException; | ||
|
||
abstract class JwtRefreshException extends AuthenticationException | ||
{ | ||
public function __construct(public readonly ?string $tokenId, public readonly ?string $userIdentifier, public readonly FailType $failType, ?Exception $previous = null) | ||
{ | ||
$message = $this->failType->value.(null !== $tokenId ? '. Token Id: '.$tokenId : '').(null !== $userIdentifier ? '. User Id: '.$userIdentifier : ''); | ||
|
||
parent::__construct($message, 0, $previous); | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yivoff\JwtRefreshBundle\Exception; | ||
|
||
use Exception; | ||
|
||
class PayloadInvalidException extends JwtRefreshException | ||
{ | ||
public function __construct(?string $tokenId, ?string $userIdentifier, ?Exception $previous = null) | ||
{ | ||
parent::__construct($tokenId, $userIdentifier, FailType::PAYLOAD, $previous); | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yivoff\JwtRefreshBundle\Exception; | ||
|
||
use Exception; | ||
|
||
class TokenExpiredException extends JwtRefreshException | ||
{ | ||
public function __construct(?string $tokenId, ?string $userIdentifier, ?Exception $previous = null) | ||
{ | ||
parent::__construct($tokenId, $userIdentifier, FailType::EXPIRED, $previous); | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yivoff\JwtRefreshBundle\Exception; | ||
|
||
use Exception; | ||
|
||
class TokenInvalidException extends JwtRefreshException | ||
{ | ||
public function __construct(?string $tokenId, ?string $userIdentifier, ?Exception $previous = null) | ||
{ | ||
parent::__construct($tokenId, $userIdentifier, FailType::INVALID, $previous); | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yivoff\JwtRefreshBundle\Exception; | ||
|
||
use Exception; | ||
|
||
class TokenNotFoundException extends JwtRefreshException | ||
{ | ||
public function __construct(?string $tokenId, ?string $userIdentifier, ?Exception $previous = null) | ||
{ | ||
parent::__construct($tokenId, $userIdentifier, FailType::NOT_FOUND, $previous); | ||
} | ||
} |
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.