Skip to content
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

Merged
merged 9 commits into from
Oct 2, 2023
Merged

Feat: IP white list #2299

merged 9 commits into from
Oct 2, 2023

Conversation

SunnyBoy-WYH
Copy link
Contributor

image

because no pd,just use java list; when pd ready , we can checkout pd.

tips:

  1. this feat work when auth mode was set.
  2. this feat work when white ip status was set to be enable.

test:

update whitelist :
image
check whitelist :

image

open whitelist :
image

# Conflicts:
#	hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java
@codecov
Copy link

codecov bot commented Aug 26, 2023

Codecov Report

Merging #2299 (05a861f) into master (4ceef1a) will decrease coverage by 0.12%.
The diff coverage is 7.05%.

@@             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     
Files Coverage Δ
...ava/org/apache/hugegraph/config/ServerOptions.java 100.00% <100.00%> (ø)
.../org/apache/hugegraph/auth/HugeGraphAuthProxy.java 56.94% <0.00%> (-0.49%) ⬇️
...org/apache/hugegraph/auth/StandardAuthManager.java 90.78% <25.00%> (-1.78%) ⬇️
...che/hugegraph/api/filter/AuthenticationFilter.java 53.57% <16.66%> (-4.43%) ⬇️
...g/apache/hugegraph/api/profile/WhiteIpListAPI.java 0.00% <0.00%> (ø)

... and 10 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -77,6 +76,10 @@ public class StandardAuthManager implements AuthManager {
private final TokenGenerator tokenGenerator;
private final long tokenExpire;

private List<String> ipWhiteList;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mark final

Copy link
Contributor Author

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?

Copy link
Member

@imbajin imbajin Sep 21, 2023

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

Copy link
Contributor Author

@SunnyBoy-WYH SunnyBoy-WYH Sep 21, 2023

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

like this?

private final List<String> ipWhiteList;

public void setWhiteIPs(List<String> ipWhiteList) {
    this.ipWhiteList.clear();
    this.ipWhiteList.addAll(ipWhiteList);
}

Copy link
Contributor Author

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

like 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);
}

whiteIpList.removeAll(existed);
result.put("removed", existedIPs);
result.put("nonexistent", loadedIPs);
whiteIpList.removeAll(existedIPs);
Copy link
Contributor

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>

javeme
javeme previously approved these changes Sep 29, 2023
Copy link
Member

@imbajin imbajin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@javeme javeme merged commit 30ef2f7 into apache:master Oct 2, 2023
18 of 21 checks passed
VGalaxies pushed a commit to VGalaxies/incubator-hugegraph that referenced this pull request Nov 10, 2023
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.
imbajin pushed a commit that referenced this pull request Nov 10, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants