From 29295e6e668db426661605e7a78cf6f58e27e092 Mon Sep 17 00:00:00 2001 From: songshiyuan 00649746 Date: Mon, 15 Jul 2024 22:49:52 +0800 Subject: [PATCH] [fix] fix the problem of can not require the api of kie when open rbac --- server/plugin/auth/buildin/buildin.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/plugin/auth/buildin/buildin.go b/server/plugin/auth/buildin/buildin.go index e22e26681..776513cd9 100644 --- a/server/plugin/auth/buildin/buildin.go +++ b/server/plugin/auth/buildin/buildin.go @@ -175,7 +175,13 @@ func (ba *TokenAuthenticator) VerifyToken(req *http.Request) (interface{}, error return nil, rbacmodel.NewError(rbacmodel.ErrNoAuthHeader, "") } claims, ok := tokenCache.Get(v) + s := strings.Split(v, " ") + if len(s) != 2 { + return nil, rbacmodel.ErrInvalidHeader + } + to := s[1] if ok { + token.WithRequest(req, to) switch claimsVal := claims.(type) { case error: return nil, claimsVal @@ -183,11 +189,6 @@ func (ba *TokenAuthenticator) VerifyToken(req *http.Request) (interface{}, error return claimsVal, nil } } - s := strings.Split(v, " ") - if len(s) != 2 { - return nil, rbacmodel.ErrInvalidHeader - } - to := s[1] claims, err := authr.Authenticate(req.Context(), to) if err != nil {