use of org.apache.activemq.jaas.JassCredentialCallbackHandler in project opennms by OpenNMS.
the class OpenNMSJaasAuthenticationBroker method authenticate.
@Override
public SecurityContext authenticate(String username, String password, X509Certificate[] certificates) throws SecurityException {
SecurityContext result = null;
JassCredentialCallbackHandler callback = new JassCredentialCallbackHandler(username, password);
try {
LoginContext lc = new LoginContext(JAAS_CONTEXT_NAME, callback);
lc.login();
Subject subject = lc.getSubject();
result = new JaasSecurityContext(username, subject);
} catch (Exception ex) {
throw new SecurityException("User name [" + username + "] or password is invalid.", ex);
}
return result;
}
Aggregations