Skip to content

Commit 302eb72

Browse files
committed
Throw exception when the mTSL (mutual TSL) certificate can not be loaded correctly instead to forward the request and get a failure response from Bitbucket data center.
This kind of client authentication seems not be supported by the data center neither documented in the user documentation, maybe candidate for removal
1 parent d1814d0 commit 302eb72

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/impl/credentials/BitbucketClientCertificateAuthenticator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
package com.cloudbees.jenkins.plugins.bitbucket.impl.credentials;
2626

2727
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketAuthenticator;
28+
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketException;
2829
import com.cloudbees.plugins.credentials.common.StandardCertificateCredentials;
2930
import hudson.util.Secret;
3031
import java.security.KeyManagementException;
3132
import java.security.KeyStore;
3233
import java.security.KeyStoreException;
3334
import java.security.NoSuchAlgorithmException;
3435
import java.security.UnrecoverableKeyException;
35-
import java.util.logging.Level;
3636
import java.util.logging.Logger;
3737
import javax.net.ssl.SSLContext;
3838
import org.apache.hc.client5.http.protocol.HttpClientContext;
@@ -78,8 +78,7 @@ public void configureContext(HttpClientContext context, HttpHost host) {
7878
.build();
7979
context.setAttribute(SOCKET_FACTORY_REGISTRY, registry); // override SSL registry for this context
8080
} catch (NoSuchAlgorithmException | UnrecoverableKeyException | KeyStoreException | KeyManagementException e) {
81-
logger.log(Level.WARNING, "Failed to set up SSL context from provided client certificate: " + e.getMessage());
82-
// TODO: handle this error in a way that provides feedback to the user
81+
throw new BitbucketException("Failed to set up SSL context from provided client certificate", e);
8382
}
8483
}
8584

0 commit comments

Comments
 (0)