-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Added param:<name> lookup option to JWT Middleware #1296
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1296 +/- ##
==========================================
- Coverage 84.21% 84.17% -0.04%
==========================================
Files 26 26
Lines 1951 1959 +8
==========================================
+ Hits 1643 1649 +6
- Misses 202 203 +1
- Partials 106 107 +1
Continue to review full report at Codecov.
|
Looks like my Codecov is showing a bunch of red, any help on how to make it happy is appreciated 💃 |
Just to follow since this PR failed code coverage -- I tried to add more tests in the style currently found, but since this adds a URL router param I failed to integrate it at that level and simply set the necessary parameters directly on the Context struct. Again, not sure the best course of action here, still think this is a valid addition to expand the use-cases for JWT. |
@alexaandru @im-kulikov What is your opinion? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@vishr Thx for dealing with the Stalebot -- I still think this is a valid addition/option for Echo! |
Reopen |
Many thanks for approving/adding this! 💯 |
I wanted to use JWTs as "tokenized" URLs and have the Middleware locate them from their URL param names:
https//example.com/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ
With a route like:
e := echo.New()
e.GET("/:token", MyHandler)
Where "token" is the
TokenLookup
option in the JWT config :param:<name>
The test(s) are a little naive since I can't route the tests thru an Echo Router, but the principal is still there, and it isn't really that big a change/addition.
Hopefully others will find this useful!