This repository has been archived by the owner on May 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
feat(security): add ReplicaSession interceptor #135
Merged
Merged
Changes from 4 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
adab598
init jaas
levy5307 ce20285
fix
levy5307 48e3d75
fix
levy5307 c5cc59a
fix
levy5307 b8367e9
fix
levy5307 4f6cf3e
fix
levy5307 baa0fc1
fix
levy5307 9e4ddac
fix
levy5307 67b2631
fix
levy5307 edc0a10
fix
levy5307 6294add
fix
levy5307 55e8eab
fix
levy5307 260e381
add config comments
levy5307 e69d2b7
ReplicaSessionHook -> ReplicaSessionInterceptor
levy5307 b19e5aa
fix
levy5307 08abb63
fix
levy5307 de6b5c7
fix
levy5307 78017a3
fix by review
levy5307 27fab2b
fix
levy5307 43fa5f2
don't let ReplicationSessionInterceptorManager be a singleton
levy5307 36a8016
remove of jaas
levy5307 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
client { | ||
com.sun.security.auth.module.Krb5LoginModule required | ||
debug=true | ||
useTicketCache=true | ||
useKeyTab=true | ||
keyTab="" | ||
renewTGT=true | ||
principal="" | ||
storeKey=true; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/com/xiaomi/infra/pegasus/rpc/async/ReplicaSessionHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.xiaomi.infra.pegasus.rpc.async; | ||
|
||
public interface ReplicaSessionHook { | ||
// The behavior when a rpc session is connected. | ||
void onConnected(ReplicaSession session); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/xiaomi/infra/pegasus/rpc/async/ReplicaSessionHookManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.xiaomi.infra.pegasus.rpc.async; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ReplicaSessionHookManager { | ||
levy5307 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private List<ReplicaSessionHook> hooks = new ArrayList<>(); | ||
private static ReplicaSessionHookManager instance = new ReplicaSessionHookManager(); | ||
|
||
public static ReplicaSessionHookManager instance() { | ||
return instance; | ||
} | ||
|
||
void addHook(ReplicaSessionHook hook) { | ||
hooks.add(hook); | ||
} | ||
|
||
public void onConnected(ReplicaSession session) { | ||
for (ReplicaSessionHook hook : hooks) { | ||
hook.onConnected(session); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.