fix: use dynamic JWT key func (#1552)

This commit is contained in:
Roland 2025-07-30 23:41:57 +07:00 committed by GitHub
parent b2fc5335c6
commit 5dbb67ff44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -111,7 +111,10 @@ func (httpSvc *HttpService) RegisterSharedRoutes(e *echo.Echo) {
NewClaimsFunc: func(c echo.Context) jwt.Claims {
return new(jwtCustomClaims)
},
SigningKey: []byte(httpSvc.cfg.GetJWTSecret()),
// use a custom key func as the JWT secret will change if the user changes their unlock password
KeyFunc: func(token *jwt.Token) (interface{}, error) {
return []byte(httpSvc.cfg.GetJWTSecret()), nil
},
}
restrictedApiGroup := e.Group("/api")
restrictedApiGroup.Use(echojwt.WithConfig(jwtConfig))