Skip to content

Commit ad20af1

Browse files
committed
Allow lookup and delete with no username.
1 parent cef4729 commit ad20af1

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

core/src/main/java/ch/cyberduck/core/DefaultHostPasswordStore.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,12 @@ public String findLoginPassword(final Host bookmark) {
4141
return null;
4242
}
4343
final Credentials credentials = bookmark.getCredentials();
44-
if(StringUtils.isEmpty(credentials.getUsername())) {
45-
log.warn("Missing username in {}", bookmark);
46-
return null;
47-
}
4844
log.info("Fetching login password from keychain for {}", bookmark);
4945
final String password;
5046
try {
5147
password = this.getPassword(bookmark.getProtocol().getScheme(), bookmark.getPort(),
5248
bookmark.getHostname(), StringUtils.isEmpty(credentials.getUsername()) ?
53-
bookmark.getProtocol().getPasswordPlaceholder() :
54-
credentials.getUsername());
49+
bookmark.getProtocol().getPasswordPlaceholder() : credentials.getUsername());
5550
}
5651
catch(LocalAccessDeniedException e) {
5752
log.warn("Failure {} searching in keychain", e.getMessage());
@@ -268,12 +263,9 @@ public void delete(final Host bookmark) throws LocalAccessDeniedException {
268263
this.deletePassword(bookmark.getHostname(), credentials.getIdentity().getAbbreviatedPath());
269264
}
270265
if(protocol.isPasswordConfigurable()) {
271-
if(StringUtils.isEmpty(credentials.getUsername())) {
272-
log.warn("No username in credentials for bookmark {}", bookmark.getHostname());
273-
return;
274-
}
275266
this.deletePassword(protocol.getScheme(), bookmark.getPort(), bookmark.getHostname(),
276-
credentials.getUsername());
267+
StringUtils.isEmpty(credentials.getUsername()) ?
268+
bookmark.getProtocol().getPasswordPlaceholder() : credentials.getUsername());
277269
}
278270
if(protocol.isTokenConfigurable()) {
279271
this.deletePassword(protocol.getScheme(), bookmark.getPort(), bookmark.getHostname(),

0 commit comments

Comments
 (0)