fix: allow proxied gb32960 platform login ips
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was canceled

This commit is contained in:
lingniu
2026-06-29 21:00:50 +08:00
parent bdc455dcf7
commit c99fa6cfb9
2 changed files with 17 additions and 0 deletions

View File

@@ -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);