-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat: support multiple extract token key #4328
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
🚀 New features to boost your workflow:
|
|
Would you please give some examples on how to use different token keys? For example, how to request the API with curl. |
c2d7e29 to
a01f817
Compare
|
According to the a-api.yaml configuration file, the
example:
If the setting curl --request GET \
--url http://127.0.0.1:8888/greet/from/me \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MjQ3NjUwMjR9.OvLg2ook9yVdBseQYkMO5wmdokYNGuaDMSa1dNkSeo8' \
--header 'content-type: application/json' |
a01f817 to
a3f44cf
Compare
|
Bearer is the standard schema, is there any official spec that talks about Bearer replacement? |
|
I look up https://golang-jwt.github.io/jwt/#jwt-and-oauth-20 have mention a point
This feature is also supported in other frameworks/libraries.
|
Implement support for multiple custom token keys and simplify the JWT authentication configuration. `WithTokenKeys` function enables setting token keys, improving the authentication process by accommodating various token header extraction strategies. by accommodating various token header extraction strategies.
Extracting JWT from different request sources (headers, query params, form data) is now configurable via `TokenLookup`.
3e19023 to
d167104
Compare
- Implement CookieExtractor and ParamExtractor for token extraction - Add tests for new token extraction methods - Improve error handling and test coverage
|
Why haven't they merged yet? |
Implement support for multiple custom token keys and simplify the JWT authentication configuration.
WithTokenLookupsfunction enables setting token keys, improving the authentication process by accommodating various token header extraction strategies. by accommodating various token header extraction strategies.example:
jwt-api.api
a-api.yaml
TokenLookupextract a jwt from custom request header or post form or get url arguments.