fix: some api bug

This commit is contained in:
wwweww
2026-03-31 22:12:06 +08:00
parent c5ff4f0216
commit e7970ac25f
219 changed files with 16195 additions and 2126 deletions
+4 -1
View File
@@ -15,6 +15,7 @@ import (
corev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
authv3 "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3"
typev3 "github.com/envoyproxy/go-control-plane/envoy/type/v3"
"github.com/zeromicro/go-zero/core/logx"
codepb "google.golang.org/genproto/googleapis/rpc/code"
statuspb "google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/grpc"
@@ -68,15 +69,17 @@ func (s *authzServer) Check(ctx context.Context, req *authv3.CheckRequest) (*aut
UserId: userID,
})
if err != nil {
logx.Infof("validate token rpc failed, err: %v", err)
return deny(codepb.Code_UNAUTHENTICATED, typev3.StatusCode_Unauthorized, "validate token failed"), nil
}
if !resp.GetValid() {
logx.Infof("validate token rpc failed, err: %v", err)
return deny(codepb.Code_PERMISSION_DENIED, typev3.StatusCode_Forbidden, "token invalid"), nil
}
outHeaders := []*corev3.HeaderValueOption{
{Header: &corev3.HeaderValue{Key: headerAuthUserID, Value: strconv.FormatInt(resp.GetUserId(), 10)}},
{Header: &corev3.HeaderValue{Key: headerAuthRoleType, Value: strconv.FormatInt(resp.GetRoleType(), 10)}},
{Header: &corev3.HeaderValue{Key: headerAuthRoleType, Value: resp.GetRoleType()}},
}
if getHeader(httpReq.GetHeaders(), headerAuthIsAdmin) != "" {