Skip to content

Commit

Permalink
fix(apigateway): set scope policy binding project id query (#21998)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito authored Jan 20, 2025
1 parent 6887125 commit ef28bc7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/apigateway/handler/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"yunion.io/x/jsonutils"
"yunion.io/x/log"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/gotypes"
"yunion.io/x/pkg/util/httputils"
"yunion.io/x/pkg/util/printutils"
"yunion.io/x/pkg/util/rbacscope"
Expand Down Expand Up @@ -221,7 +222,17 @@ var (
)

func (h *AuthHandlers) getScopedPolicyBindings(ctx context.Context, w http.ResponseWriter, req *http.Request) {
_, params, _ := appsrv.FetchEnv(ctx, w, req)
_, _params, _ := appsrv.FetchEnv(ctx, w, req)
if gotypes.IsNil(_params) {
_params = jsonutils.NewDict()
}
params := _params.(*jsonutils.JSONDict)
token, _, err := fetchAuthInfo(ctx, req)
if err != nil {
httperrors.GeneralServerError(ctx, w, err)
return
}
params.Set("project_id", jsonutils.NewString(token.GetProjectId()))
hash := fmt.Sprintf("%x", md5.Sum([]byte(params.String())))
cache := bindingCache.Get(hash)
if cache != nil {
Expand Down

0 comments on commit ef28bc7

Please sign in to comment.