Merge pull request #24721 from overleaf/msm-cleanup-git-oauth-secret

[git-bridge] Cleanup `oauth` clientID/secret

GitOrigin-RevId: 48144d928119782d1c7b048b0cb6a4afb6072f28
This commit is contained in:
Miguel Serrano
2025-04-08 14:01:23 +02:00
committed by Copybot
parent b41f8164b8
commit 44926d3519
10 changed files with 30 additions and 107 deletions

View File

@@ -1495,13 +1495,9 @@ public class WLGitBridgeIntegrationTest {
+ port
+ "\",\n"
+ " \"serviceName\": \"Overleaf\",\n"
+ " \"oauth2\": {\n"
+ " \"oauth2ClientID\": \"clientID\",\n"
+ " \"oauth2ClientSecret\": \"oauth2 client secret\",\n"
+ " \"oauth2Server\": \"http://127.0.0.1:"
+ " \"oauth2Server\": \"http://127.0.0.1:"
+ apiPort
+ "\"\n"
+ " }";
+ "\"";
if (swapCfg != null) {
cfgStr +=
",\n"
@@ -1524,7 +1520,6 @@ public class WLGitBridgeIntegrationTest {
+ ",\n"
+ " \"intervalMillis\": "
+ swapCfg.getIntervalMillis()
+ "\n"
+ " }\n";
}
cfgStr += "}\n";

View File

@@ -23,11 +23,7 @@ public class ConfigTest {
+ " \"apiBaseUrl\": \"http://127.0.0.1:60000/api/v0\",\n"
+ " \"postbackBaseUrl\": \"http://127.0.0.1\",\n"
+ " \"serviceName\": \"Overleaf\",\n"
+ " \"oauth2\": {\n"
+ " \"oauth2ClientID\": \"clientID\",\n"
+ " \"oauth2ClientSecret\": \"oauth2 client secret\",\n"
+ " \"oauth2Server\": \"https://www.overleaf.com\"\n"
+ " }\n"
+ " \"oauth2Server\": \"https://www.overleaf.com\"\n"
+ "}\n");
Config config = new Config(reader);
assertEquals(80, config.getPort());
@@ -35,10 +31,7 @@ public class ConfigTest {
assertEquals("http://127.0.0.1:60000/api/v0/", config.getAPIBaseURL());
assertEquals("http://127.0.0.1/", config.getPostbackURL());
assertEquals("Overleaf", config.getServiceName());
assertTrue(config.isUsingOauth2());
assertEquals("clientID", config.getOauth2().getOauth2ClientID());
assertEquals("oauth2 client secret", config.getOauth2().getOauth2ClientSecret());
assertEquals("https://www.overleaf.com", config.getOauth2().getOauth2Server());
assertEquals("https://www.overleaf.com", config.getOauth2Server());
}
@Test(expected = AssertionError.class)
@@ -53,7 +46,7 @@ public class ConfigTest {
+ " \"apiBaseUrl\": \"http://127.0.0.1:60000/api/v0\",\n"
+ " \"postbackBaseUrl\": \"http://127.0.0.1\",\n"
+ " \"serviceName\": \"Overleaf\",\n"
+ " \"oauth2\": null\n"
+ " \"oauth2Server\": null\n"
+ "}\n");
Config config = new Config(reader);
assertEquals(80, config.getPort());
@@ -61,8 +54,7 @@ public class ConfigTest {
assertEquals("http://127.0.0.1:60000/api/v0/", config.getAPIBaseURL());
assertEquals("http://127.0.0.1/", config.getPostbackURL());
assertEquals("Overleaf", config.getServiceName());
assertFalse(config.isUsingOauth2());
config.getOauth2();
assertNull(config.getOauth2Server());
}
@Test
@@ -77,11 +69,7 @@ public class ConfigTest {
+ " \"apiBaseUrl\": \"http://127.0.0.1:60000/api/v0\",\n"
+ " \"postbackBaseUrl\": \"http://127.0.0.1\",\n"
+ " \"serviceName\": \"Overleaf\",\n"
+ " \"oauth2\": {\n"
+ " \"oauth2ClientID\": \"my oauth2 client id\",\n"
+ " \"oauth2ClientSecret\": \"my oauth2 client secret\",\n"
+ " \"oauth2Server\": \"https://www.overleaf.com\"\n"
+ " }\n"
+ " \"oauth2Server\": \"https://www.overleaf.com\"\n"
+ "}\n");
Config config = new Config(reader);
String expected =
@@ -94,11 +82,7 @@ public class ConfigTest {
+ " \"apiBaseURL\": \"http://127.0.0.1:60000/api/v0/\",\n"
+ " \"postbackURL\": \"http://127.0.0.1/\",\n"
+ " \"serviceName\": \"Overleaf\",\n"
+ " \"oauth2\": {\n"
+ " \"oauth2ClientID\": \"<oauth2ClientID>\",\n"
+ " \"oauth2ClientSecret\": \"<oauth2ClientSecret>\",\n"
+ " \"oauth2Server\": \"https://www.overleaf.com\"\n"
+ " },\n"
+ " \"oauth2Server\": \"https://www.overleaf.com\",\n"
+ " \"userPasswordEnabled\": false,\n"
+ " \"repoStore\": null,\n"
+ " \"swapStore\": null,\n"