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