Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store proxy password and apikeys in native OS credential store #10044

Merged
merged 23 commits into from
Jul 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Result of discussion
Co-authored-by: Carl Christian Snethlage <[email protected]>
koppor and calixtus committed Jul 1, 2023
commit 695a443105e589b6bac0a92ab5fde4c0a10fdb02
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/JabRefGUI.java
Original file line number Diff line number Diff line change
@@ -93,15 +93,15 @@ private void setupProxy() {
preferencesService.getProxyPreferences().setPassword(password.get());
ProxyRegisterer.register(preferencesService.getProxyPreferences());
} else {
LOGGER.warn("No proxy password specified");
LOGGER.warn("No proxy password specified");
}
return;
}

try (final Keyring keyring = Keyring.create()) {
String password = new Password(
keyring.getPassword("org.jabref", "proxy"),
preferencesService.getProxyPreferences().getUsername())
preferencesService.getInternalPreferences().getUserAndHost())
.decrypt();
preferencesService.getProxyPreferences().setPassword(password);
ProxyRegisterer.register(preferencesService.getProxyPreferences());
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/logic/net/ProxyPreferences.java
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ public void setPort(String port) {
}

public final boolean shouldUseAuthentication() {
return useAuthentication.getValue();
return useAuthentication.get();
}

public BooleanProperty useAuthenticationProperty() {
@@ -106,7 +106,7 @@ public void setPassword(String password) {
}

public boolean shouldPersistPassword() {
return persistPassword.getValue();
return persistPassword.get();
}

public BooleanProperty persistPasswordProperty() {
Original file line number Diff line number Diff line change
@@ -536,9 +536,8 @@ static void moveApiKeysToKeyring(JabRefPreferences preferences) {
.encrypt());
}
preferences.deleteKey(V5_9_FETCHER_CUSTOM_KEYS);
} catch (
Exception ex) {
LOGGER.error("Unable to open key store");
} catch (Exception ex) {
LOGGER.error("Unable to open key store", ex);
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/preferences/JabRefPreferences.java
Original file line number Diff line number Diff line change
@@ -1547,11 +1547,11 @@ public ProxyPreferences getProxyPreferences() {
} else {
keyring.setPassword("org.jabref", "proxy", new Password(
newValue.trim(),
proxyPreferences.getUsername())
getInternalPreferences().getUserAndHost())
.encrypt());
}
} catch (Exception ex) {
LOGGER.warn("Unable to open key store");
LOGGER.warn("Unable to open key store", ex);
}
}
});