public static AuthenticationManager getAuthenticationManager() {
AuthenticationManager manager = new AuthenticationManager();
manager.registerAuthenticationProvider( new NoAuthenticationAuthenticationProvider() );
for ( PluginInterface plugin : PluginRegistry.getInstance().getPlugins( AuthenticationConsumerPluginType.class ) ) {
try {
Object pluginMain = PluginRegistry.getInstance().loadClass( plugin );
if ( pluginMain instanceof AuthenticationConsumerType ) {
Class<? extends AuthenticationConsumer<?, ?>> consumerClass =
( (AuthenticationConsumerType) pluginMain ).getConsumerClass();
manager.registerConsumerClass( consumerClass );
} else {
throw new KettlePluginException( BaseMessages.getString( PKG,
"AuthenticationPersistenceManager.NotConsumerType", pluginMain, AuthenticationConsumerType.class ) );
}
} catch ( KettlePluginException e ) {
log.logError( e.getMessage(), e );
} catch ( AuthenticationFactoryException e ) {
log.logError( e.getMessage(), e );
}
}
return manager;
}