code refactor

This commit is contained in:
MaysWind
2025-07-24 23:58:24 +08:00
parent d6ee8a416f
commit d385358aa3
6 changed files with 76 additions and 60 deletions
-20
View File
@@ -1,20 +0,0 @@
package utils
import (
"net/http"
"github.com/golang-jwt/jwt/v5/request"
)
// CookieExtractor extracts a token from request cookies
type CookieExtractor []string
func (e CookieExtractor) ExtractToken(req *http.Request) (string, error) {
for _, arg := range e {
if cookie, _ := req.Cookie(arg); cookie != nil {
return cookie.Value, nil
}
}
return "", request.ErrNoTokenInRequest
}