Skip to content

Commit

Permalink
Merge pull request #2700 from brusdev/ISSUE_2699
Browse files Browse the repository at this point in the history
fix(hawtio-system): fix support for ActiveMQ Artemis client certificate login #2699
  • Loading branch information
tadayosi committed Sep 21, 2021
2 parents d6c8ea4 + 0fef61a commit d655aab
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions hawtio-system/src/main/java/io/hawt/system/Authenticator.java
Expand Up @@ -475,11 +475,19 @@ public void handle(Callback[] callbacks) {

private void setCertificates(Callback callback) {
try {
// Artemis still uses deprecated javax.security.cert.X509Certificate class
Method method = callback.getClass().getDeclaredMethod(ARTEMIS_CALLBACK_METHOD, javax.security.cert.X509Certificate[].class);
method.invoke(callback, new Object[] { toJavax(certificates) });
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | CertificateEncodingException | CertificateException e) {
LOG.error("Setting certificates to callback failed", e);
// Artemis uses java.security.cert.X509Certificate class since the 2.18.0 version.
Method method = callback.getClass().getDeclaredMethod(ARTEMIS_CALLBACK_METHOD, java.security.cert.X509Certificate[].class);
method.invoke(callback, new Object[] { certificates });
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
LOG.warn("Setting certificates to new callback failed", e);

try {
// Artemis used deprecated javax.security.cert.X509Certificate class up to the 2.17.0 version.
Method method = callback.getClass().getDeclaredMethod(ARTEMIS_CALLBACK_METHOD, javax.security.cert.X509Certificate[].class);
method.invoke(callback, new Object[] { toJavax(certificates) });
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | CertificateEncodingException | CertificateException ex) {
LOG.error("Setting certificates to callback failed", ex);
}
}
}

Expand Down

0 comments on commit d655aab

Please sign in to comment.