-
Notifications
You must be signed in to change notification settings - Fork 520
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
Feat: IP white list #2299
Feat: IP white list #2299
Conversation
# Conflicts: # hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
Codecov Report
@@ Coverage Diff @@
## master #2299 +/- ##
============================================
- Coverage 68.26% 68.15% -0.12%
Complexity 989 989
============================================
Files 500 501 +1
Lines 41516 41601 +85
Branches 5786 5799 +13
============================================
+ Hits 28342 28353 +11
- Misses 10415 10491 +76
+ Partials 2759 2757 -2
... and 10 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/org/apache/hugegraph/auth/AuthManager.java
Outdated
Show resolved
Hide resolved
@@ -77,6 +76,10 @@ public class StandardAuthManager implements AuthManager { | |||
private final TokenGenerator tokenGenerator; | |||
private final long tokenExpire; | |||
|
|||
private List<String> ipWhiteList; |
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.
mark final
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.
mark final maybe we cant change it anymore?
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.
mark final maybe we cant change it anymore?
for Object
, final
/static
will just fix the Memory Pointer Address, won't influence the inner value
just like the head pointer in the linked list
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.
mark final maybe we cant change it anymore?
for
Object
,final
/static
will just fix the Memory Pointer Address, won't influence the inner valuejust like the head pointer in the linked list
like this?
private final List<String> ipWhiteList;
public void setWhiteIPs(List<String> ipWhiteList) {
this.ipWhiteList.clear();
this.ipWhiteList.addAll(ipWhiteList);
}
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.
mark final maybe we cant change it anymore?
for
Object
,final
/static
will just fix the Memory Pointer Address, won't influence the inner value
just like the head pointer in the linked listlike this? we cant change object pointer. so we cant use
this.ipWhiteList = ipWhiteList
in setWhiteIPs func.private final List<String> ipWhiteList; public void setWhiteIPs(List<String> ipWhiteList) { this.ipWhiteList.clear(); this.ipWhiteList.addAll(ipWhiteList); }
hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
Outdated
Show resolved
Hide resolved
whiteIpList.removeAll(existed); | ||
result.put("removed", existedIPs); | ||
result.put("nonexistent", loadedIPs); | ||
whiteIpList.removeAll(existedIPs); |
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.
try to set the type of whiteIpList to Set<String>
hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/api/profile/WhiteIpListAPI.java
Outdated
Show resolved
Hide resolved
hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
Outdated
Show resolved
Hide resolved
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
tips: - this feat works when auth mode was set. - this feat works when white ip status was enabled. because now PD is unavailable,just use java list; when pd ready , we can checkout pd.
tips: - this feat works when auth mode was set. - this feat works when white ip status was enabled. because now PD is unavailable,just use java list; when pd ready , we can checkout pd.
because no pd,just use java list; when pd ready , we can checkout pd.
tips:
test:
update whitelist :
check whitelist :
open whitelist :