fix: allow proxied gb32960 platform login ips
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was canceled
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was canceled
This commit is contained in:
@@ -61,6 +61,21 @@ class Gb32960AccessServiceTest {
|
||||
.accepted()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void authenticatePlatformLogin_acceptsCommaSeparatedAllowedIps() {
|
||||
Gb32960Properties.Auth auth = new Gb32960Properties.Auth();
|
||||
Gb32960Properties.Auth.Platform platform = new Gb32960Properties.Auth.Platform();
|
||||
platform.setUsername("lingniu");
|
||||
platform.setPassword("secret");
|
||||
platform.setAllowedIps(List.of("115.29.187.205,127.0.0.1"));
|
||||
auth.setPlatforms(List.of(platform));
|
||||
|
||||
Gb32960PlatformAuthorizer authorizer = new Gb32960PlatformAuthorizer(auth.getPlatforms());
|
||||
|
||||
assertThat(authorizer.authenticate("lingniu", "secret", "127.0.0.1")
|
||||
.accepted()).isTrue();
|
||||
}
|
||||
|
||||
private static Gb32960AccessService newService(boolean vinAuthEnabled) {
|
||||
Gb32960Properties.Auth auth = new Gb32960Properties.Auth();
|
||||
auth.setEnabled(vinAuthEnabled);
|
||||
|
||||
Reference in New Issue
Block a user