This commit is contained in:
yanweidong 2024-03-15 15:28:53 +08:00
parent 76fd17c0f0
commit 25ecea7e09
2 changed files with 1 additions and 7 deletions

2
go.mod
View File

@ -1,3 +1,3 @@
module git.apinb.com/bsm-sdk/engine module git.apinb.com/bsm-sdk/engine
go 1.22 go 1.22

View File

@ -7,7 +7,6 @@ import (
"git.apinb.com/bsm-sdk/engine/encipher" "git.apinb.com/bsm-sdk/engine/encipher"
"git.apinb.com/bsm-sdk/engine/exception" "git.apinb.com/bsm-sdk/engine/exception"
"git.apinb.com/bsm-sdk/engine/types" "git.apinb.com/bsm-sdk/engine/types"
"git.apinb.com/bsm-sdk/engine/utils"
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"
) )
@ -38,11 +37,6 @@ func ParseMetaCtx(ctx context.Context, opts *ParseOptions) (*types.JwtClaims, er
if !strings.Contains(claims.Role, opts.RoleValue) { if !strings.Contains(claims.Role, opts.RoleValue) {
return nil, exception.ErrPermissionDenied return nil, exception.ErrPermissionDenied
} }
if opts.MustPrivateAllow {
if utils.IsPublicIP(claims.Client) {
return nil, exception.ErrPermissionDenied
}
}
} }
return claims, nil return claims, nil