-
Notifications
You must be signed in to change notification settings - Fork 25
feat(security): add ReplicaSession interceptor #135
Conversation
levy5307
commented
Sep 21, 2020
•
edited by foreverneverer
Loading
edited by foreverneverer
- add ReplicaSession hook to deal with some situations, such as session connected、sending a message.
- add some configurations
src/main/java/com/xiaomi/infra/pegasus/client/ClientOptions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/xiaomi/infra/pegasus/client/ClientOptions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/xiaomi/infra/pegasus/client/ClientOptions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/xiaomi/infra/pegasus/rpc/async/SecurityReplicaSessionHook.java
Outdated
Show resolved
Hide resolved
configuration/pegasus_jaas.conf
Outdated
@@ -0,0 +1,10 @@ | |||
client { | |||
com.sun.security.auth.module.Krb5LoginModule required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this config format support comment? Can you write a comment of description on top of each config item?
Furthermore, does it mean that every of our users should have this file in their project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the pegasus_jaas.conf
. So we can add it in later pull request. And I will refactor it in a better way at that time.
src/main/java/com/xiaomi/infra/pegasus/rpc/async/ReplicaSessionHookManager.java
Outdated
Show resolved
Hide resolved
src/main/java/com/xiaomi/infra/pegasus/rpc/async/ClusterManager.java
Outdated
Show resolved
Hide resolved
public ReplicaSession( | ||
rpc_address address, EventLoopGroup rpcGroup, int socketTimeout, boolean enableAuth) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can pass ClientOptions here. Each ReplicaSession creates its ReplicaSessionInterceptorManager separately.
public ReplicaSession(rpc_address address, EventLoopGroup rpcGroup, int socketTimeout, ClientOptions opts) {
interceptors = new ReplicaSessionInterceptorManager(opts);
enableAuth = opts.enableAuth();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should create a ReplicaSessionInterceptorManager
for each ReplicationSession
. Each ClusterManager has a ReplicaSessionInterceptorManager
is enough