debug: add JWT secret empty check logging
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -39,7 +40,11 @@ func JWTAuth() gin.HandlerFunc {
|
||||
claims := &Claims{}
|
||||
|
||||
token, err := jwt.ParseWithClaims(tokenString, claims, func(token *jwt.Token) (interface{}, error) {
|
||||
return []byte(config.Cfg.JWT.Secret), nil
|
||||
secret := config.Cfg.JWT.Secret
|
||||
if secret == "" {
|
||||
log.Printf("JWT Secret is empty, config.Cfg: %+v", config.Cfg)
|
||||
}
|
||||
return []byte(secret), nil
|
||||
})
|
||||
|
||||
if err != nil || !token.Valid {
|
||||
|
||||
Reference in New Issue
Block a user