mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 06:53:41 -05:00
Remove old username/password settings
These were once used to secure interactions with the web api, back when we allowed anonymous access to git repositories. This feature was dropped in the migration to Overleaf v2, and we use OAuth on those interactions anyway, so these settings are not actually used for anything, and keeping these around is just confusing.
This commit is contained in:
parent
c043988027
commit
2efc7f22a7
9 changed files with 0 additions and 63 deletions
|
@ -2,8 +2,6 @@
|
||||||
"port": ${GIT_BRIDGE_PORT:-8000},
|
"port": ${GIT_BRIDGE_PORT:-8000},
|
||||||
"rootGitDirectory": "${GIT_BRIDGE_ROOT_DIR:-/tmp/wlgb}",
|
"rootGitDirectory": "${GIT_BRIDGE_ROOT_DIR:-/tmp/wlgb}",
|
||||||
"apiBaseUrl": "${GIT_BRIDGE_API_BASE_URL:-https://localhost/api/v0}",
|
"apiBaseUrl": "${GIT_BRIDGE_API_BASE_URL:-https://localhost/api/v0}",
|
||||||
"username": "${GIT_BRIDGE_USERNAME}",
|
|
||||||
"password": "${GIT_BRIDGE_PASSWORD}",
|
|
||||||
"postbackBaseUrl": "${GIT_BRIDGE_POSTBACK_BASE_URL:-https://localhost}",
|
"postbackBaseUrl": "${GIT_BRIDGE_POSTBACK_BASE_URL:-https://localhost}",
|
||||||
"serviceName": "${GIT_BRIDGE_SERVICE_NAME:-Overleaf}",
|
"serviceName": "${GIT_BRIDGE_SERVICE_NAME:-Overleaf}",
|
||||||
"oauth2": {
|
"oauth2": {
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
"port": 8080,
|
"port": 8080,
|
||||||
"rootGitDirectory": "/tmp/wlgb",
|
"rootGitDirectory": "/tmp/wlgb",
|
||||||
"apiBaseUrl": "https://localhost/api/v0",
|
"apiBaseUrl": "https://localhost/api/v0",
|
||||||
"username": "user",
|
|
||||||
"password": "pass",
|
|
||||||
"postbackBaseUrl": "https://localhost",
|
"postbackBaseUrl": "https://localhost",
|
||||||
"serviceName": "Overleaf",
|
"serviceName": "Overleaf",
|
||||||
"oauth2": {
|
"oauth2": {
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
"port": 8000,
|
"port": 8000,
|
||||||
"rootGitDirectory": "/tmp/wlgb",
|
"rootGitDirectory": "/tmp/wlgb",
|
||||||
"apiBaseUrl": "http://v2.overleaf.test:4000/api/v0",
|
"apiBaseUrl": "http://v2.overleaf.test:4000/api/v0",
|
||||||
"username": "user",
|
|
||||||
"password": "pass",
|
|
||||||
"postbackBaseUrl": "http://git-bridge:8000",
|
"postbackBaseUrl": "http://git-bridge:8000",
|
||||||
"serviceName": "Overleaf",
|
"serviceName": "Overleaf",
|
||||||
"oauth2": {
|
"oauth2": {
|
||||||
|
|
|
@ -25,8 +25,6 @@ public class Config implements JSONSource {
|
||||||
return new Config(
|
return new Config(
|
||||||
config.port,
|
config.port,
|
||||||
config.rootGitDirectory,
|
config.rootGitDirectory,
|
||||||
config.username,
|
|
||||||
"<password>",
|
|
||||||
config.apiBaseURL,
|
config.apiBaseURL,
|
||||||
config.postbackURL,
|
config.postbackURL,
|
||||||
config.serviceName,
|
config.serviceName,
|
||||||
|
@ -39,8 +37,6 @@ public class Config implements JSONSource {
|
||||||
|
|
||||||
private int port;
|
private int port;
|
||||||
private String rootGitDirectory;
|
private String rootGitDirectory;
|
||||||
private String username;
|
|
||||||
private String password;
|
|
||||||
private String apiBaseURL;
|
private String apiBaseURL;
|
||||||
private String postbackURL;
|
private String postbackURL;
|
||||||
private String serviceName;
|
private String serviceName;
|
||||||
|
@ -67,8 +63,6 @@ public class Config implements JSONSource {
|
||||||
public Config(
|
public Config(
|
||||||
int port,
|
int port,
|
||||||
String rootGitDirectory,
|
String rootGitDirectory,
|
||||||
String username,
|
|
||||||
String password,
|
|
||||||
String apiBaseURL,
|
String apiBaseURL,
|
||||||
String postbackURL,
|
String postbackURL,
|
||||||
String serviceName,
|
String serviceName,
|
||||||
|
@ -79,8 +73,6 @@ public class Config implements JSONSource {
|
||||||
) {
|
) {
|
||||||
this.port = port;
|
this.port = port;
|
||||||
this.rootGitDirectory = rootGitDirectory;
|
this.rootGitDirectory = rootGitDirectory;
|
||||||
this.username = username;
|
|
||||||
this.password = password;
|
|
||||||
this.apiBaseURL = apiBaseURL;
|
this.apiBaseURL = apiBaseURL;
|
||||||
this.postbackURL = postbackURL;
|
this.postbackURL = postbackURL;
|
||||||
this.serviceName = serviceName;
|
this.serviceName = serviceName;
|
||||||
|
@ -98,8 +90,6 @@ public class Config implements JSONSource {
|
||||||
configObject,
|
configObject,
|
||||||
"rootGitDirectory"
|
"rootGitDirectory"
|
||||||
).getAsString();
|
).getAsString();
|
||||||
username = getOptionalString(configObject, "username");
|
|
||||||
password = getOptionalString(configObject, "password");
|
|
||||||
String apiBaseURL = getElement(
|
String apiBaseURL = getElement(
|
||||||
configObject,
|
configObject,
|
||||||
"apiBaseUrl"
|
"apiBaseUrl"
|
||||||
|
@ -138,14 +128,6 @@ public class Config implements JSONSource {
|
||||||
return rootGitDirectory;
|
return rootGitDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAPIBaseURL() {
|
public String getAPIBaseURL() {
|
||||||
return apiBaseURL;
|
return apiBaseURL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,10 +73,6 @@ public class GitBridgeServer {
|
||||||
);
|
);
|
||||||
jettyServer = new Server(port);
|
jettyServer = new Server(port);
|
||||||
configureJettyServer(config, repoStore, snapshotApi);
|
configureJettyServer(config, repoStore, snapshotApi);
|
||||||
SnapshotAPIRequest.setBasicAuth(
|
|
||||||
config.getUsername(),
|
|
||||||
config.getPassword()
|
|
||||||
);
|
|
||||||
apiBaseURL = config.getAPIBaseURL();
|
apiBaseURL = config.getAPIBaseURL();
|
||||||
SnapshotAPIRequest.setBaseURL(apiBaseURL);
|
SnapshotAPIRequest.setBaseURL(apiBaseURL);
|
||||||
Util.setServiceName(config.getServiceName());
|
Util.setServiceName(config.getServiceName());
|
||||||
|
|
|
@ -11,9 +11,6 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public abstract class SnapshotAPIRequest<T extends Result> extends Request<T> {
|
public abstract class SnapshotAPIRequest<T extends Result> extends Request<T> {
|
||||||
|
|
||||||
private static String USERNAME;
|
|
||||||
private static String PASSWORD;
|
|
||||||
|
|
||||||
private static String BASE_URL;
|
private static String BASE_URL;
|
||||||
|
|
||||||
private final Credential oauth2;
|
private final Credential oauth2;
|
||||||
|
@ -33,27 +30,11 @@ public abstract class SnapshotAPIRequest<T extends Result> extends Request<T> {
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
if (oauth2 != null) {
|
if (oauth2 != null) {
|
||||||
request.setInterceptor(request1 -> {
|
request.setInterceptor(request1 -> {
|
||||||
new BasicAuthentication(
|
|
||||||
USERNAME,
|
|
||||||
PASSWORD
|
|
||||||
).intercept(request1);
|
|
||||||
oauth2.intercept(request1);
|
oauth2.intercept(request1);
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
request.setInterceptor(request1 -> {
|
|
||||||
new BasicAuthentication(
|
|
||||||
USERNAME,
|
|
||||||
PASSWORD
|
|
||||||
).intercept(request1);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setBasicAuth(String username, String password) {
|
|
||||||
USERNAME = username;
|
|
||||||
PASSWORD = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* baseURL ends with / */
|
/* baseURL ends with / */
|
||||||
public static void setBaseURL(String baseURL) {
|
public static void setBaseURL(String baseURL) {
|
||||||
BASE_URL = baseURL + "docs/";
|
BASE_URL = baseURL + "docs/";
|
||||||
|
|
|
@ -1069,8 +1069,6 @@ public class WLGitBridgeIntegrationTest {
|
||||||
" \"apiBaseUrl\": \"http://127.0.0.1:" +
|
" \"apiBaseUrl\": \"http://127.0.0.1:" +
|
||||||
apiPort +
|
apiPort +
|
||||||
"/api/v0\",\n" +
|
"/api/v0\",\n" +
|
||||||
" \"username\": \"\",\n" +
|
|
||||||
" \"password\": \"\",\n" +
|
|
||||||
" \"postbackBaseUrl\": \"http://127.0.0.1:" +
|
" \"postbackBaseUrl\": \"http://127.0.0.1:" +
|
||||||
port +
|
port +
|
||||||
"\",\n" +
|
"\",\n" +
|
||||||
|
|
|
@ -18,8 +18,6 @@ public class ConfigTest {
|
||||||
" \"port\": 80,\n" +
|
" \"port\": 80,\n" +
|
||||||
" \"rootGitDirectory\": \"/var/wlgb/git\",\n" +
|
" \"rootGitDirectory\": \"/var/wlgb/git\",\n" +
|
||||||
" \"apiBaseUrl\": \"http://127.0.0.1:60000/api/v0\",\n" +
|
" \"apiBaseUrl\": \"http://127.0.0.1:60000/api/v0\",\n" +
|
||||||
" \"username\": \"REDACTED\",\n" +
|
|
||||||
" \"password\": \"REDACTED\",\n" +
|
|
||||||
" \"postbackBaseUrl\": \"http://127.0.0.1\",\n" +
|
" \"postbackBaseUrl\": \"http://127.0.0.1\",\n" +
|
||||||
" \"serviceName\": \"Overleaf\",\n" +
|
" \"serviceName\": \"Overleaf\",\n" +
|
||||||
" \"oauth2\": {\n" +
|
" \"oauth2\": {\n" +
|
||||||
|
@ -32,8 +30,6 @@ public class ConfigTest {
|
||||||
assertEquals(80, config.getPort());
|
assertEquals(80, config.getPort());
|
||||||
assertEquals("/var/wlgb/git", config.getRootGitDirectory());
|
assertEquals("/var/wlgb/git", config.getRootGitDirectory());
|
||||||
assertEquals("http://127.0.0.1:60000/api/v0/", config.getAPIBaseURL());
|
assertEquals("http://127.0.0.1:60000/api/v0/", config.getAPIBaseURL());
|
||||||
assertEquals("REDACTED", config.getUsername());
|
|
||||||
assertEquals("REDACTED", config.getPassword());
|
|
||||||
assertEquals("http://127.0.0.1/", config.getPostbackURL());
|
assertEquals("http://127.0.0.1/", config.getPostbackURL());
|
||||||
assertEquals("Overleaf", config.getServiceName());
|
assertEquals("Overleaf", config.getServiceName());
|
||||||
assertTrue(config.isUsingOauth2());
|
assertTrue(config.isUsingOauth2());
|
||||||
|
@ -48,8 +44,6 @@ public class ConfigTest {
|
||||||
" \"port\": 80,\n" +
|
" \"port\": 80,\n" +
|
||||||
" \"rootGitDirectory\": \"/var/wlgb/git\",\n" +
|
" \"rootGitDirectory\": \"/var/wlgb/git\",\n" +
|
||||||
" \"apiBaseUrl\": \"http://127.0.0.1:60000/api/v0\",\n" +
|
" \"apiBaseUrl\": \"http://127.0.0.1:60000/api/v0\",\n" +
|
||||||
" \"username\": \"REDACTED\",\n" +
|
|
||||||
" \"password\": \"REDACTED\",\n" +
|
|
||||||
" \"postbackBaseUrl\": \"http://127.0.0.1\",\n" +
|
" \"postbackBaseUrl\": \"http://127.0.0.1\",\n" +
|
||||||
" \"serviceName\": \"Overleaf\",\n" +
|
" \"serviceName\": \"Overleaf\",\n" +
|
||||||
" \"oauth2\": null\n" +
|
" \"oauth2\": null\n" +
|
||||||
|
@ -58,8 +52,6 @@ public class ConfigTest {
|
||||||
assertEquals(80, config.getPort());
|
assertEquals(80, config.getPort());
|
||||||
assertEquals("/var/wlgb/git", config.getRootGitDirectory());
|
assertEquals("/var/wlgb/git", config.getRootGitDirectory());
|
||||||
assertEquals("http://127.0.0.1:60000/api/v0/", config.getAPIBaseURL());
|
assertEquals("http://127.0.0.1:60000/api/v0/", config.getAPIBaseURL());
|
||||||
assertEquals("REDACTED", config.getUsername());
|
|
||||||
assertEquals("REDACTED", config.getPassword());
|
|
||||||
assertEquals("http://127.0.0.1/", config.getPostbackURL());
|
assertEquals("http://127.0.0.1/", config.getPostbackURL());
|
||||||
assertEquals("Overleaf", config.getServiceName());
|
assertEquals("Overleaf", config.getServiceName());
|
||||||
assertFalse(config.isUsingOauth2());
|
assertFalse(config.isUsingOauth2());
|
||||||
|
@ -72,8 +64,6 @@ public class ConfigTest {
|
||||||
" \"port\": 80,\n" +
|
" \"port\": 80,\n" +
|
||||||
" \"rootGitDirectory\": \"/var/wlgb/git\",\n" +
|
" \"rootGitDirectory\": \"/var/wlgb/git\",\n" +
|
||||||
" \"apiBaseUrl\": \"http://127.0.0.1:60000/api/v0\",\n" +
|
" \"apiBaseUrl\": \"http://127.0.0.1:60000/api/v0\",\n" +
|
||||||
" \"username\": \"username\",\n" +
|
|
||||||
" \"password\": \"my super secret password\",\n" +
|
|
||||||
" \"postbackBaseUrl\": \"http://127.0.0.1\",\n" +
|
" \"postbackBaseUrl\": \"http://127.0.0.1\",\n" +
|
||||||
" \"serviceName\": \"Overleaf\",\n" +
|
" \"serviceName\": \"Overleaf\",\n" +
|
||||||
" \"oauth2\": {\n" +
|
" \"oauth2\": {\n" +
|
||||||
|
@ -86,8 +76,6 @@ public class ConfigTest {
|
||||||
String expected = "{\n" +
|
String expected = "{\n" +
|
||||||
" \"port\": 80,\n" +
|
" \"port\": 80,\n" +
|
||||||
" \"rootGitDirectory\": \"/var/wlgb/git\",\n" +
|
" \"rootGitDirectory\": \"/var/wlgb/git\",\n" +
|
||||||
" \"username\": \"username\",\n" +
|
|
||||||
" \"password\": \"<password>\",\n" +
|
|
||||||
" \"apiBaseURL\": \"http://127.0.0.1:60000/api/v0/\",\n" +
|
" \"apiBaseURL\": \"http://127.0.0.1:60000/api/v0/\",\n" +
|
||||||
" \"postbackURL\": \"http://127.0.0.1/\",\n" +
|
" \"postbackURL\": \"http://127.0.0.1/\",\n" +
|
||||||
" \"serviceName\": \"Overleaf\",\n" +
|
" \"serviceName\": \"Overleaf\",\n" +
|
||||||
|
|
|
@ -58,8 +58,6 @@ public class BridgeTest {
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|
Loading…
Reference in a new issue