Skip to content

Commit d505e40

Browse files
committed
Add parameter to retrieve private key for mTLS.
1 parent 1e44b4d commit d505e40

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ public KeychainLoginService(final HostPasswordStore keychain) {
4141
}
4242

4343
@Override
44-
public void validate(final Session<?> session, final LoginCallback prompt, final LoginOptions options) throws ConnectionCanceledException, LoginFailureException {
45-
log.debug("Validate login credentials for {}", session);
46-
final Host host = session.getHost();
44+
public void validate(final Host host, final X509KeyManager keys, final LoginCallback prompt, final LoginOptions options) throws ConnectionCanceledException, LoginFailureException {
45+
log.debug("Validate login credentials for {}", host);
4746
final Credentials credentials = host.getCredentials();
4847
if(credentials.isPublicKeyAuthentication()) {
4948
if(!credentials.getIdentity().attributes().getPermission().isReadable()) {
@@ -92,9 +91,8 @@ public void validate(final Session<?> session, final LoginCallback prompt, final
9291
if(options.certificate) {
9392
final String alias = host.getCredentials().getCertificate();
9493
if(StringUtils.isNotBlank(alias)) {
95-
final X509KeyManager manager = session.getFeature(X509KeyManager.class);
96-
if(manager != null) {
97-
if(null == manager.getPrivateKey(alias)) {
94+
if(keys != null) {
95+
if(null == keys.getPrivateKey(alias)) {
9896
log.warn("No private key found for alias {} in keychain", alias);
9997
throw new LoginFailureException(LocaleFactory.localizedString("Provide additional login credentials", "Credentials"));
10098
}

0 commit comments

Comments
 (0)