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 all 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,69 @@ | ||
<?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_SIGNATURE = 15; | ||
public const OPENSSL_CAN_NOT_SIGN_DATA = 16; | ||
public const SODIUM_KEY_IS_NOT_STRING = 17; | ||
public const SODIUM_FUNC_DOES_NOT_EXIST = 18; | ||
public const SODIUM_KEY_LENGTH_ZERO = 19; | ||
public const SODIUM_VERIFY_KEY_LENGTH_ZERO = 20; | ||
public const SODIUM_VERIFY_SIGNATURE_EMPTY = 21; | ||
public const SODIUM_EXCEPTION = 22; | ||
public const SIGN_GENERAL_EXCEPTION = 23; | ||
public const VERIFY_ALGORITHM_NOT_SUPPORTED = 24; | ||
public const VERIFY_OPEN_SSL_ERROR = 25; | ||
public const VERIFY_SODIUM_NOT_AVAILABLE = 26; | ||
public const VERIFY_KEY_MATERIAL_IS_NOT_STRING = 27; | ||
public const VERIFY_SODIUM_EXCEPTION = 28; | ||
public const VERIFY_KEY_IS_NOT_STRING = 29; | ||
public const DECODED_JSON_IS_NULL = 30; | ||
public const ENCODED_JSON_IS_NULL = 31; | ||
public const INVALID_JSON = 32; | ||
public const KID_IS_EMPTY = 33; | ||
public const KID_IS_INVALID = 34; | ||
public const JSON_ERROR = 35; | ||
public const KEY_ID_NOT_FOUND = 36; | ||
public const OFFSET_SET_METHOD_NOT_IMPLEMENTED = 37; | ||
public const OFFSET_UNSET_METHOD_NOT_IMPLEMENTED = 38; | ||
public const JWKS_URI_IS_EMPTY = 39; | ||
public const JWK_MISSING_KEYS = 40; | ||
public const JWT_KEYS_IS_EMPTY = 41; | ||
public const JWT_ALGORITHM_NOT_SUPPORTED = 42; | ||
public const JWK_IS_EMPTY = 43; | ||
public const JWT_MISSING_KTY_PARAMETER = 44; | ||
public const JWT_MISSING_ALG_PARAMETER = 45; | ||
public const JWT_RSA_KEYS_NOT_SUPPORTED = 46; | ||
public const JWT_RSA_KEYS_MISSING_N_AND_E = 47; | ||
public const JWT_OPEN_SSL_ERROR = 48; | ||
public const JWK_EC_D_IS_NOT_SET = 49; | ||
public const JWT_EC_CRV_IS_EMPTY = 50; | ||
public const JWK_UNSUPPORTED_EC_CURVE = 51; | ||
public const JWT_X_AND_Y_ARE_EMPTY = 52; | ||
public const KEY_MATERIAL_IS_INVALID = 53; | ||
public const KEY_MATERIAL_IS_EMPTY = 54; | ||
public const KEY_ALGORITHM_IS_EMPTY = 55; | ||
public const CACHED_KEY_MISSING = 56; | ||
public const CACHED_KEY_EMPTY = 57; | ||
public const CACHED_KEY_GET_JWK = 58; | ||
public const JWK_OKP_MISSING = 59; | ||
public const JWT_CRV_MISSING = 60; | ||
public const JWT_CRV_UNSUPPORTED = 61; | ||
public const JWT_X_MISSING = 62; | ||
} |
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.