Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| JwtException | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace LambdaTwelve\OneRecord\Auth\Jwt; |
| 6 | |
| 7 | use RuntimeException; |
| 8 | |
| 9 | /** |
| 10 | * A token that must not be accepted. The reason is a stable code for logs and |
| 11 | * metrics; the message never echoes token content. |
| 12 | */ |
| 13 | final class JwtException extends RuntimeException |
| 14 | { |
| 15 | public const string MALFORMED = 'malformed'; |
| 16 | public const string UNSUPPORTED_ALGORITHM = 'unsupported_algorithm'; |
| 17 | public const string UNKNOWN_ISSUER = 'unknown_issuer'; |
| 18 | public const string BAD_SIGNATURE = 'bad_signature'; |
| 19 | public const string EXPIRED = 'expired'; |
| 20 | public const string NOT_YET_VALID = 'not_yet_valid'; |
| 21 | public const string AUDIENCE_MISMATCH = 'audience_mismatch'; |
| 22 | public const string MISSING_CLAIM = 'missing_claim'; |
| 23 | public const string INVALID_CLAIM = 'invalid_claim'; |
| 24 | |
| 25 | public function __construct(public readonly string $reason, string $message) |
| 26 | { |
| 27 | parent::__construct($message); |
| 28 | } |
| 29 | } |