feat: support multiple extract token key#4328
feat: support multiple extract token key#4328ch3nnn wants to merge 6 commits intozeromicro:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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.