add gateway

This commit is contained in:
2025-03-30 13:23:46 +08:00
parent ca00b34e24
commit 93daa022bc
4 changed files with 53 additions and 14 deletions

View File

@@ -30,6 +30,17 @@ func ParseMetaCtx(ctx context.Context, opts *ParseOptions) (*Meta, error) {
return nil, errcode.ErrJWTAuthNotFound
}
// 安全获取 metadata 中的值
identityValues := md.Get("authorization_identity")
clientValues := md.Get("client")
if len(identityValues) == 0 {
return nil, errcode.ErrJWTAuthNotFound
}
if len(clientValues) == 0 {
return nil, errcode.ErrJWTAuthNotFound
}
meta := &Meta{
IDENTITY: md["authorization_identity"][0],
CLIENT: md["client"][0],