Can I customize middlewareImpl or MiddlewareFunc?
- Dominant language
- Go
- Stars
- 3k
- Forks
- 387
- Avg merge
- 4h 16m
- Merged PRs (30d)
- 1
Description
I'd like to use this extension but I want to redefine it's core function. Can I do this?
**What I actually want to do**
I want not to terminate request if JWT is wrong or empty like here: https://github.com/appleboy/gin-jwt/blob/633d983b91f09beefb1128c4558d4642a379c602/auth_jwt.go#L350
But instead let each endpoint to decide what is allowed and what is not based on context["id"] which was set by middleware either to nil or User model.
So I want this middleware only to do all JWT stuff and `c.Set(mw.IdentityKey, identity)` but not to make any 401 respond.
If I can do it now - can you show how?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with auth_jwt.go around line 350 and inspect the middlewareImpl and MiddlewareFunc behavior described in the issue. Determine whether the middleware's JWT processing and identity-setting can be separated from its 401 response handling, then define the expected endpoint behavior for invalid or missing JWTs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- authentication, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100