Skip to content

RedisConnContext 添加auth信息支持多租户场景 #2901

Description

@lintanghui

Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)

redis 协议中 RedisCommandHandler的run方法只传递了命令参数,没有连接上下文信息,导致无法获取连接的session信息,在多租户场景中, 没有ctx session没法区分不同租户的连接鉴权信息。
Describe the solution you'd like (描述你期望的解决方法)
在run方法添加参数 RedisConnContext* ctx, 通过ctx可以获取该链接的session信息。

Describe alternatives you've considered (描述你想到的折衷方案)

Additional context/screenshots (更多上下文/截图)

// 默认实现兼容旧的run方法
virtual RedisCommandHandlerResult Run(RedisConnContext* ctx, const std::vector<butil::StringPiece>& args,
                                          brpc::RedisReply* output,
                                          bool flush_batched) {
        return Run(args, output, flush_batched);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions