fix: allow Hong Kong login access
This commit is contained in:
parent
769af267ea
commit
2ad23b068d
@ -39,10 +39,10 @@ public class LoginAccessValidationService {
|
|||||||
"香港", "澳门", "澳門", "台湾", "台灣", "Hong Kong", "Macau", "Macao", "Taiwan"
|
"香港", "澳门", "澳門", "台湾", "台灣", "Hong Kong", "Macau", "Macao", "Taiwan"
|
||||||
);
|
);
|
||||||
private static final List<String> BLOCKED_COUNTRY_CODES = List.of(
|
private static final List<String> BLOCKED_COUNTRY_CODES = List.of(
|
||||||
"HK", "MO", "SG", "TW"
|
"MO", "SG", "TW"
|
||||||
);
|
);
|
||||||
private static final List<String> BLOCKED_COUNTRY_NAMES = List.of(
|
private static final List<String> BLOCKED_COUNTRY_NAMES = List.of(
|
||||||
"香港", "澳门", "澳門", "台湾", "台灣", "Hong Kong", "Macau", "Macao", "Taiwan", "新加坡", "Singapore"
|
"澳门", "澳門", "台湾", "台灣", "Macau", "Macao", "Taiwan", "新加坡", "Singapore"
|
||||||
);
|
);
|
||||||
private static final List<IpGeoProvider> IP_GEO_PROVIDERS = List.of(
|
private static final List<IpGeoProvider> IP_GEO_PROVIDERS = List.of(
|
||||||
new IpGeoProvider("ip.sb", "https://api.ip.sb/geoip/%s"),
|
new IpGeoProvider("ip.sb", "https://api.ip.sb/geoip/%s"),
|
||||||
|
|||||||
@ -70,13 +70,22 @@ public class LoginAccessValidationServiceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void blockHongKongRegion() {
|
public void allowHongKongRegion() {
|
||||||
JSONObject data = JSON.parseObject("""
|
JSONObject data = JSON.parseObject("""
|
||||||
{"country_id":"CN","country":"中国","region":"香港"}
|
{"country_id":"CN","country":"中国","region":"香港"}
|
||||||
""");
|
""");
|
||||||
|
|
||||||
assertFalse(LoginAccessValidationService.isMainlandChina(data));
|
assertFalse(LoginAccessValidationService.isMainlandChina(data));
|
||||||
assertTrue(LoginAccessValidationService.isBlockedIpRegion(data));
|
assertFalse(LoginAccessValidationService.isBlockedIpRegion(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void allowHongKongCountryCode() {
|
||||||
|
JSONObject data = JSON.parseObject("""
|
||||||
|
{"country_id":"HK","country":"Hong Kong","region":"Kwai Tsing District"}
|
||||||
|
""");
|
||||||
|
|
||||||
|
assertFalse(LoginAccessValidationService.isBlockedIpRegion(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user