use of com.sequenceiq.cloudbreak.reactor.api.event.ldap.LdapSSOConfigurationFailed in project cloudbreak by hortonworks.
the class LdapSSOConfigurationHandler method accept.
@Override
public void accept(Event<LdapSSOConfigurationRequest> ldapConfigurationRequestEvent) {
Long stackId = ldapConfigurationRequestEvent.getData().getResourceId();
Selectable response;
try {
Stack stack = stackService.getByIdWithListsInTransaction(stackId);
GatewayConfig primaryGatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stack);
LdapView ldapView = ldapConfigService.get(stack.getEnvironmentCrn(), stack.getName()).orElse(null);
String environmentCrnForVirtualGroups = environmentConfigProvider.getParentEnvironmentCrn(stack.getEnvironmentCrn());
VirtualGroupRequest virtualGroupRequest = new VirtualGroupRequest(environmentCrnForVirtualGroups, ldapView != null ? ldapView.getAdminGroup() : "");
clusterApiConnectors.getConnector(stack).clusterSecurityService().setupLdapAndSSO(primaryGatewayConfig.getPublicAddress(), ldapView, virtualGroupRequest);
response = new LdapSSOConfigurationSuccess(stackId);
} catch (Exception e) {
LOGGER.info("Error during LDAP configuration, stackId: " + stackId, e);
response = new LdapSSOConfigurationFailed(stackId, e);
}
eventBus.notify(response.selector(), new Event<>(ldapConfigurationRequestEvent.getHeaders(), response));
}
Aggregations