Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(hawtio-system): fix support for ActiveMQ Artemis client certificate login #2699 #2700

Merged
merged 1 commit into from Sep 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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