use of org.talend.sdk.component.server.configuration.ComponentServerConfiguration in project component-runtime by Talend.
the class SecurityExtension method bindSecurityHandlers.
void bindSecurityHandlers(@Observes final AfterDeploymentValidation afterDeploymentValidation, final BeanManager beanManager) {
final ComponentServerConfiguration configuration = ComponentServerConfiguration.class.cast(beanManager.getReference(beanManager.resolve(beanManager.getBeans(ComponentServerConfiguration.class)), ComponentServerConfiguration.class, beanManager.createCreationalContext(null)));
final String connectionHandler = configuration.securityConnectionHandler();
onConnectionMtd = ofNullable(onConnectionObservers.get(connectionHandler)).orElseThrow(() -> new IllegalArgumentException("No handler '" + connectionHandler + "'"));
final String commandHandler = configuration.securityCommandHandler();
onCommandMtd = ofNullable(onCommandObservers.get(commandHandler)).orElseThrow(() -> new IllegalArgumentException("No handler '" + commandHandler + "'"));
// no more needed
onConnectionObservers.clear();
onCommandObservers.clear();
log.info("Security configured with connection handler '{}' and command handler '{}'", connectionHandler, commandHandler);
}
Aggregations