Comments (6)
Better error reporting for jws.Verify is something that I'm absolutely 👍 for, but I'm not 100% as to exactly what you're going after.
For example,
If I got keys from jwk.Fetch and similar, I might be almost 100% sure that issue is because of invalid signature.
But would be nice to know that for sure.
What does this (jwk.Fetch) have to do with jws.Verify
and verifyError?
Perhaps... are you dynamically loading keys in a KeyProvider? And this is failing and you want to differentiate against this line?
(If this is the case I can certainly accept a PR with your proposed change, as long as there are test cases included :)
from jwx.
I do
claims, err := jwt.Parse(bearerToken, jwt.WithVerify(false))
- then based on value from
claims.Issuer()
I callkeySet, err := jwk.Fetch()
and do some caching - and finally
jws.Verify(bearerToken, jws.WithKeySet(keySet))
That's why I'm almost 100% sure, that if jws.Verify is failing, it is due to invalid signature, because token was parsed and keySet should be valid as it is returned by jwk.Fetch()
.
So I would like to differentiate basically any error from jws.Verify
with this line https://github.com/lestrrat-go/jwx/blob/develop/v2/jws/jws.go#L451
from jwx.
Okay, so your proposed changes for IsVerifyError
makes sense to me. I'm still on vacation, so if you're in a hurry, please consider filing a PR. Otherwise I will get on it sometime next week
from jwx.
@arxeiss I got other stuff that I also need to fix on this module, so I'll work on this now
from jwx.
@arxeiss Please check #1049. I opted to rename the function IsVerificationError
. After implementing IsVerifyError
, I compared it to jws.Verify
and I thought it was unclear what IsVerifyError
checks for from the naming -- technically, all errors returned from jws.Verify
would be a "VerifyError", right? So while it's a bit more typing, I opted for the IsVerificationError
name.
from jwx.
You were much faster than I'm. I had to focus to different task so I put this on hold. I checked the PR, seems good. Thank you
from jwx.
Related Issues (20)
- `WithInferAlgorithmFromKey` should cache inferences alas HOT 3
- Simple custom field on a JWT token HOT 5
- Update go version within go.mod
- `jwk.SetGlobalFetcher` requires object implementing interface with unexported methods HOT 19
- [v3] Deprecate jwk's global fetcher
- [doc] CVE-2024-21664 - Missing v1 fix version HOT 9
- [v1][v2] Add option to disallow JSON format for JWTs HOT 2
- Disabling kid check with jws.Verify on a JWKSet HOT 2
- jwt.ParseRequest should also look for the token in cookies HOT 3
- How to Sign a jwt token with just a string and not publicKey and privateKey HOT 2
- [v2] Accessing registered claims during verification (keyprovider) HOT 6
- Support the new fully-specified JOSE algorithms HOT 2
- Support for custom key usage types in JWKs HOT 3
- Ability to work with PEM/DER for secp256k1 HOT 14
- jwx command-line tool does not support PEM output for secp256k1 HOT 2
- [v3] Change KeyUsageType's Accept behavior to be by default strict, and allow toggling the feature
- Validate everything but expiration HOT 6
- How am I supposed to parse tokens created with: jwt.NewSerializer. HOT 7
- Unable to get expiration date HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jwx.