@@ -49,7 +49,9 @@ public String findLoginPassword(final Host bookmark) {
49
49
final String password ;
50
50
try {
51
51
password = this .getPassword (bookmark .getProtocol ().getScheme (), bookmark .getPort (),
52
- bookmark .getHostname (), credentials .getUsername ());
52
+ bookmark .getHostname (), StringUtils .isEmpty (credentials .getUsername ()) ?
53
+ bookmark .getProtocol ().getPasswordPlaceholder () :
54
+ String .format ("%s (%s)" , bookmark .getProtocol ().getPasswordPlaceholder (), credentials .getUsername ()));
53
55
}
54
56
catch (LocalAccessDeniedException e ) {
55
57
log .warn ("Failure {} searching in keychain" , e .getMessage ());
@@ -74,7 +76,8 @@ public String findLoginToken(final Host bookmark) {
74
76
try {
75
77
token = this .getPassword (bookmark .getProtocol ().getScheme (), bookmark .getPort (),
76
78
bookmark .getHostname (), StringUtils .isEmpty (credentials .getUsername ()) ?
77
- bookmark .getProtocol ().getTokenPlaceholder () : String .format ("%s (%s)" , bookmark .getProtocol ().getTokenPlaceholder (), credentials .getUsername ()));
79
+ bookmark .getProtocol ().getTokenPlaceholder () :
80
+ String .format ("%s (%s)" , bookmark .getProtocol ().getTokenPlaceholder (), credentials .getUsername ()));
78
81
}
79
82
catch (LocalAccessDeniedException e ) {
80
83
log .warn ("Failure {} searching in keychain" , e .getMessage ());
@@ -218,12 +221,9 @@ public void save(final Host bookmark) throws LocalAccessDeniedException {
218
221
log .warn ("No username in credentials for bookmark {}" , bookmark .getHostname ());
219
222
return ;
220
223
}
221
- if (StringUtils .isEmpty (credentials .getPassword ())) {
222
- log .warn ("No password in credentials for bookmark {}" , bookmark .getHostname ());
223
- return ;
224
- }
225
224
this .addPassword (protocol .getScheme (), bookmark .getPort (),
226
- bookmark .getHostname (), credentials .getUsername (), credentials .getPassword ());
225
+ bookmark .getHostname (), StringUtils .isEmpty (credentials .getUsername ()) ?
226
+ protocol .getPasswordPlaceholder () : String .format ("%s (%s)" , protocol .getPasswordPlaceholder (), credentials .getUsername ()), credentials .getPassword ());
227
227
}
228
228
if (credentials .isTokenAuthentication ()) {
229
229
this .addPassword (protocol .getScheme (), bookmark .getPort (),
0 commit comments