use of org.apache.activemq.artemis.spi.core.security.jaas.CertificateCallback in project activemq-artemis by apache.
the class TextFileCertificateLoginModuleTest method getJaasCertificateCallbackHandler.
private JaasCallbackHandler getJaasCertificateCallbackHandler(String user) {
JMXPrincipal principal = new JMXPrincipal(user);
X509Certificate cert = new StubX509Certificate(principal);
return new JaasCallbackHandler(null, null, null) {
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (Callback callback : callbacks) {
if (callback instanceof CertificateCallback) {
CertificateCallback certCallback = (CertificateCallback) callback;
certCallback.setCertificates(new X509Certificate[] { cert });
} else {
throw new UnsupportedCallbackException(callback);
}
}
}
};
}
Aggregations