-
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
feat: adds payload to exceptions #292
Conversation
DanteMarshal
commented
Apr 20, 2020
•
edited
Loading
edited
- Add payload to following exceptions :
- ExpiredException
- Signature Exception
- Add and Run Tests
* Add payload to following exceptions : - ExpiredException - Signature Exception + Add and Run Tests Note : I have run the tests using Php 7.2.24 Someone please run the tests using Php 5.3
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
1 similar comment
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
1 similar comment
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
Travis failing on checkstyle with nothing but this information :
Can someone help please ? I don't know what I should do here. |
I think you're missing a newline at the end of the file, i.e. an empty line 13. |
Awesome, thanks for the PR!! I’m a bit uncertain about attaching the payload to a SignatureInvalidException : is the payload even meaningful if it was never cryptographically valid? My intuition says no: the token isn’t valid and shouldn’t be parsed in any way. |
Yes, As mentioned by @Krisell in #291 ...
But maybe someone needs to access the data in payload in order to process the exception, or perhaps for logging reasons. I believe Processing means using the payload in calculations for returning a response; which does not include logging on the server-side and inner exception handling stuff. At least for me, that was the reason I required it, because I needed to see a part of the payload after after it was expired to use it for future logging. |
Picking this back up cuz I really want this feature. My earlier point is that if the token is not cryptographically valid (its signature doesn't match its payload) then the whole token is invalid, payload and all, and should just be flatly rejected. There's no guarantee that the payload is even valid JSON here, unlike in the expired case, where the payload JSON is necessarily valid since it had to be decoded in order to determine the expiration time. |
Well the developer already knows it's invalid, cuz it's inside an exception; Why would anyone use that to process responses ? Btw @bendoh, just a sidenote; If you're really in a hurry you can just make a copy of the library, make the changes you need and put it inside your project's files. I did that cuz I wasn't gonna wait for this to be merged. |
Only because the token is expired, doesn't mean, all its values are invalid. You are right, when you say the token (as a whole) should not be processed. I for example would like to access a refresh token stored within an expired token - that is by your definition invalid and MUST NOT be processed by the (low-level) php-jwt library. Thus my highlevel logic doesn't work anymore. In my opinion the library should mark the token as invalid and let the highlevel logic decide wheater to discard the "invalid" token. btw - just for the lulz: https://youtu.be/4HJ-Y8YTo8Q |
Any specific reason why this is not being merged? |
I don't think we want this feature. I'm not convinced it's useful. |
After reading the linked issue and seeing the amount of traffic, I don't see any reason why we can't reopen and merge this. I will create a new PR and add some changes. |