-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize: add secure authentication to interfaces in ClusterController #6042
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## 2.x #6042 +/- ##
============================================
- Coverage 49.57% 49.20% -0.37%
+ Complexity 4789 4787 -2
============================================
Files 909 913 +4
Lines 31416 31685 +269
Branches 3778 3824 +46
============================================
+ Hits 15573 15592 +19
- Misses 14305 14546 +241
- Partials 1538 1547 +9
|
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
此pr依赖jwt的续期机制,由于jwt的续期机制还没有实现,因此考虑基于现有的jwt接口进行修改,基于目前的jwt验证有两个方案: Option 1: Seata-discovery-raft initializes and activates a scheduled task to call the login interface for token refresh. This requires adding a configuration item for the scheduled task execution period, ensuring that the task interval is shorter than the token expiration time configured on the server. Option 2: Seata-discovery-raft saves the token and its expiration time. Before each call to the clusterController's interface, it checks whether the current time is greater than the expiration time. If true, it calls the login interface to refresh the token. This approach requires modifying the existing JWT authentication interface, as it currently only returns a token and does not include the token expiration time. |
i will try to add some test later. |
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
# Conflicts: # discovery/seata-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
…y/registry/raft/RaftRegistryServiceImpl.java Co-authored-by: funkye <[email protected]>
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
…y/registry/raft/RaftRegistryServiceImpl.java Co-authored-by: funkye <[email protected]>
…y/registry/raft/RaftRegistryServiceImpl.java Co-authored-by: funkye <[email protected]>
…y/registry/raft/RaftRegistryServiceImpl.java Co-authored-by: funkye <[email protected]>
common/src/main/java/io/seata/common/exception/RetryableException.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
...a-discovery-raft/src/main/java/io/seata/discovery/registry/raft/RaftRegistryServiceImpl.java
Outdated
Show resolved
Hide resolved
…y/registry/raft/RaftRegistryServiceImpl.java Co-authored-by: funkye <[email protected]>
…y/registry/raft/RaftRegistryServiceImpl.java Co-authored-by: funkye <[email protected]>
…y/registry/raft/RaftRegistryServiceImpl.java Co-authored-by: funkye <[email protected]>
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.
LGTM
// get token and set it in cache | ||
if (StringUtils.isNotBlank(raftClusterAddress)) { | ||
String[] tcAddressList = raftClusterAddress.split(","); | ||
String tcAddress = tcAddressList[0]; |
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.
What happens if the original ip1 goes offline?
Ⅰ. Describe what this PR did
Add secure authentication to interfaces in ClusterController,all requesets in seata-discovery-raft will take token to visit clusterController interface.
Ⅱ. Does this pull request fix one issue?
fixes #6012
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews
TODO: It is necessary to implement the JWT renewal mechanism first.