forked from luciferous/jwt
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add code for each Exception #456
Open
nicumicle
wants to merge
18
commits into
firebase:main
Choose a base branch
from
nicumicle:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
45cb0f4
Add error codes to all exceptions
nicumicle da07b36
Refactor Exception codes
nicumicle 6d41ab7
Add newline at end of file
nicumicle a2d3bb7
Add public to const in BeforeValidException
nicumicle bf7d6db
Fix exception codes
nicumicle abf93d1
Move all exception codes to the ExceptionCodes class
nicumicle 1b9d33a
Add error codes to all exceptions
nicumicle 6451f85
Refactor Exception codes
nicumicle 33b5104
Add newline at end of file
nicumicle 2f467b3
Add public to const in BeforeValidException
nicumicle 38b5fe6
Fix exception codes
nicumicle 11271dc
Move all exception codes to the ExceptionCodes class
nicumicle 47a3afd
Merging main
nicumicle 8a85356
Merge branch 'main' into main
bshaffer 750ceb8
Merge branch 'main' into main
bshaffer ff1f054
Update src/JWT.php
bshaffer b0aa2d5
Merge branch 'main' into main
nicumicle 2e50332
add exception codes
nicumicle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace Firebase\JWT; | ||
|
||
class ExceptionCodes | ||
{ | ||
public const KEY_NOT_EMPTY = 1; | ||
public const WRONG_NUMBER_OF_SEGMENTS = 2; | ||
public const INVALID_HEADER_ENCODING = 3; | ||
public const INVALID_CLAIMS_ENCODING = 4; | ||
public const PAYLOAD_NOT_JSON = 5; | ||
public const EMPTY_ALGORITHM = 6; | ||
public const DECODE_ALGORITHM_NOT_SUPPORTED = 7; | ||
public const INCORRECT_KEY_FOR_ALGORITHM = 8; | ||
public const SIGNATURE_VERIFICATION_FAILED = 9; | ||
public const NBF_PRIOR_TO_DATE = 10; | ||
public const IAT_PRIOR_TO_DATE = 11; | ||
public const TOKEN_EXPIRED = 12; | ||
public const SIGN_ALGORITHM_NOT_SUPPORTED = 13; | ||
public const KEY_IS_NOT_STRING = 14; | ||
public const OPENSSL_CAN_NOT_SIGN_DATA = 15; | ||
public const SODIUM_KEY_IS_NOT_STRING = 16; | ||
public const SODIUM_EXCEPTION = 17; | ||
public const SIGN_GENERAL_EXCEPTION = 18; | ||
public const VERIFY_ALGORITHM_NOT_SUPPORTED = 19; | ||
public const VERIFY_OPEN_SSL_ERROR = 20; | ||
public const VERIFY_SODIUM_NOT_AVAILABLE = 21; | ||
public const VERIFY_KEY_MATERIAL_IS_NOT_STRING = 22; | ||
public const VERIFY_SODIUM_EXCEPTION = 23; | ||
public const VERIFY_KEY_IS_NOT_STRING = 24; | ||
public const DECODED_JSON_IS_NULL = 25; | ||
public const ENCODED_JSON_IS_NULL = 26; | ||
public const INVALID_JSON = 27; | ||
public const KID_IS_EMPTY = 28; | ||
public const KID_IS_INVALID = 29; | ||
public const JSON_ERROR = 30; | ||
|
||
public const KEY_ID_NOT_FOUND = 31; | ||
public const OFFSET_SET_METHOD_NOT_IMPLEMENTED = 32; | ||
public const OFFSET_UNSET_METHOD_NOT_IMPLEMENTED = 33; | ||
|
||
public const JWKS_URI_IS_EMPTY = 34; | ||
|
||
public const JWK_MISSING_KEYS = 35; | ||
public const JWT_KEYS_IS_EMPTY = 36; | ||
public const JWT_ALGORITHM_NOT_SUPPORTED = 37; | ||
public const JWK_IS_EMPTY = 38; | ||
public const JWT_MISSING_KTY_PARAMETER = 39; | ||
public const JWT_MISSING_ALG_PARAMETER = 40; | ||
public const JWT_RSA_KEYS_NOT_SUPPORTED = 41; | ||
public const JWT_RSA_KEYS_MISSING_N_AND_E = 42; | ||
public const JWT_OPEN_SSL_ERROR = 43; | ||
public const JWK_EC_D_IS_NOT_SET = 44; | ||
public const JWT_EC_CRV_IS_EMPTY = 45; | ||
public const JWK_UNSUPPORTED_EC_CURVE = 46; | ||
public const JWT_X_AND_Y_ARE_EMPTY = 47; | ||
|
||
public const KEY_MATERIAL_IS_INVALID = 48; | ||
public const KEY_MATERIAL_IS_EMPTY = 49; | ||
public const KEY_ALGORITHM_IS_EMPTY = 50; | ||
} |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest making this an interface (such as
JwtException
) and then having the Exceptions here all implement that interface.