JWT, KeyAuth, CSRF multivalue extractors#2060
Merged
aldas merged 4 commits intolabstack:masterfrom Jan 24, 2022
Merged
Conversation
…`next(c)` when error handler decides to swallow the error (returns nil).
Codecov Report
@@ Coverage Diff @@
## master #2060 +/- ##
==========================================
+ Coverage 91.57% 92.02% +0.44%
==========================================
Files 33 34 +1
Lines 2921 2972 +51
==========================================
+ Hits 2675 2735 +60
+ Misses 157 149 -8
+ Partials 89 88 -1
Continue to review full report at Codecov.
|
lammel
reviewed
Jan 4, 2022
Contributor
Author
|
@lammel if you have time could you review. I like to include it in next release. |
Contributor
Will look into it today. |
lammel
reviewed
Jan 9, 2022
Contributor
lammel
left a comment
There was a problem hiding this comment.
Looks good.
When comments from the review are resolved we should merge.
…ocs, add additional tests
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Authenticationheader with valueBearer xxxxbut your intracture has upstream proxy that adds Basic authentication also. Now even if you fill basic auth in browser and your application sends requests with JWT token you would be in trouble as previously JWT middleware knows only to extract firstAuthenticationheader value - which could be JWT token but could be also Basic Auth. This change allows extractor to return all those header values and run JWT token checks or validation for Keyauth on them.NoErrorContinuesExecutionto JWT and KeyAuth middleware to allow continuing executionnext(c)when error handler decides to swallow the error (returns nil). Usecase: This is useful in cases when portion of your site/api is publicly accessible and has extra features for authorized users. In that case you can use ErrorHandlerWithContext to set default public JWT token value to request and continue with handler chain. Note: this is similar to Allow JWT middleware to gracefully fail #2048p.s. there are ugly error handling parts just to preserve similar/same errors that those middlewares previously returned. Unfortunately all these 3 are quite inconsistent how they do error handling - JWT has 2 generic types. Keyauth has specific error values.