This is an automated email from the ASF dual-hosted git repository.
youling1128 pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git
The following commit(s) were added to refs/heads/dev by this push:
new dc6d3d19 [fix] fix the problem of can not require the api of kie when
open rbac (#1486)
dc6d3d19 is described below
commit dc6d3d1966ff4c6e68b51f7275ed248689bf8998
Author: tornado-ssy <[email protected]>
AuthorDate: Tue Jul 16 17:47:10 2024 +0800
[fix] fix the problem of can not require the api of kie when open rbac
(#1486)
---
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 e22e2668..776513cd 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 {