Search in sources :

Example 1 with ConnectorType

use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.

the class DefaultAccAccountService method getConnectorObject.

@Override
public IcConnectorObject getConnectorObject(AccAccountDto account, BasePermission... permissions) {
    Assert.notNull(account, "Account cannot be null!");
    this.checkAccess(account, permissions);
    List<SysSchemaAttributeDto> schemaAttributes = this.getSchemaAttributes(account.getSystem(), null);
    if (schemaAttributes == null) {
        return null;
    }
    try {
        // Find connector-type.
        SysSystemDto systemDto = lookupService.lookupEmbeddedDto(account, AccAccount_.system);
        ConnectorType connectorType = connectorManager.findConnectorTypeBySystem(systemDto);
        // Find first mapping for entity type and system, from the account and return his object class.
        IcObjectClass icObjectClass = schemaObjectClassService.findByAccount(account.getSystem(), account.getEntityType());
        IcConnectorObject fullObject = this.systemService.readConnectorObject(account.getSystem(), account.getRealUid(), icObjectClass, connectorType);
        return this.getConnectorObjectForSchema(fullObject, schemaAttributes);
    } catch (Exception ex) {
        SysSystemDto system = DtoUtils.getEmbedded(account, AccAccount_.system, SysSystemDto.class);
        throw new ResultCodeException(AccResultCode.ACCOUNT_CANNOT_BE_READ_FROM_TARGET, ImmutableMap.of("account", account.getUid(), "system", system != null ? system.getName() : account.getSystem()), ex);
    }
}
Also used : ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException)

Example 2 with ConnectorType

use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.

the class SysSystemController method loadConnectorType.

@ResponseBody
@RequestMapping(path = "/connector-types/load", method = RequestMethod.PUT)
@PreAuthorize("hasAuthority('" + AccGroupPermission.SYSTEM_READ + "')")
@ApiOperation(value = "Load data for specific connector type -> open existed system in the wizard step.", nickname = "loadConnectorType", response = ConnectorTypeDto.class, tags = { SysSystemController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_READ, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_READ, description = "") }) })
public ResponseEntity<ConnectorTypeDto> loadConnectorType(@NotNull @Valid @RequestBody ConnectorTypeDto connectorTypeDto) {
    if (!connectorTypeDto.isReopened()) {
        // Load default values for new system.
        ConnectorTypeDto result = connectorManager.load(connectorTypeDto);
        return new ResponseEntity<ConnectorTypeDto>(result, HttpStatus.OK);
    }
    // Load data for already existed system.
    String systemId = connectorTypeDto.getMetadata().get(AbstractConnectorType.SYSTEM_DTO_KEY);
    Assert.notNull(systemId, "System ID have to be present in the connector type metadata.");
    SysSystemDto systemDto = getDto(systemId);
    if (systemDto != null) {
        // If connector name is null, then default connector type will be used.
        if (Strings.isBlank(connectorTypeDto.getId())) {
            ConnectorType connectorType = connectorManager.findConnectorTypeBySystem(systemDto);
            ConnectorTypeDto newConnectorTypeDto = connectorManager.convertTypeToDto(connectorType);
            newConnectorTypeDto.setReopened(connectorTypeDto.isReopened());
            newConnectorTypeDto.setMetadata(connectorTypeDto.getMetadata());
            connectorTypeDto = newConnectorTypeDto;
        }
        connectorTypeDto.getEmbedded().put(AbstractConnectorType.SYSTEM_DTO_KEY, systemDto);
        ConnectorTypeDto result = connectorManager.load(connectorTypeDto);
        return new ResponseEntity<ConnectorTypeDto>(result, HttpStatus.OK);
    }
    throw new ResultCodeException(CoreResultCode.NOT_FOUND, ImmutableMap.of("entity", systemId));
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) ResponseEntity(org.springframework.http.ResponseEntity) AbstractConnectorType(eu.bcvsolutions.idm.acc.connector.AbstractConnectorType) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with ConnectorType

use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.

the class AdUserConnectorType method getConnectorValuesByAttribute.

/**
 * Search connector values for given attribute.
 * If is system in cross-domain system group, then is will be call this method for all systems in a group.
 * For searching in other systems will be used SID, GROUPS and 'foreignSecurityPrincipals' container.
 */
@Override
public List<Object> getConnectorValuesByAttribute(String uid, IcObjectClass objectClass, String schemaAttributeName, SysSystemDto system, IcConnectorObject connectorObject, SysSystemGroupSystemDto systemGroupSystem) {
    List<Object> connectorValues = super.getConnectorValuesByAttribute(uid, objectClass, schemaAttributeName, system, connectorObject, systemGroupSystem);
    if (systemGroupSystem == null) {
        // Find if the system is in a group with cross-domain type and for given schema attribute.
        SysSystemGroupSystemFilter systemGroupSystemFilter = new SysSystemGroupSystemFilter();
        systemGroupSystemFilter.setGroupType(SystemGroupType.CROSS_DOMAIN);
        systemGroupSystemFilter.setDisabled(Boolean.FALSE);
        systemGroupSystemFilter.setSystemId(system.getId());
        systemGroupSystemFilter.setMergeAttributeCode(schemaAttributeName);
        UUID systemGroupId = systemGroupSystemService.find(systemGroupSystemFilter, null).getContent().stream().findFirst().map(SysSystemGroupSystemDto::getSystemGroup).orElse(null);
        if (systemGroupId == null) {
            // System is not in a cross-domain group -> we have all connector values.
            return connectorValues;
        }
        // Found all group-systems for this group (without given system).
        systemGroupSystemFilter.setSystemGroupId(systemGroupId);
        systemGroupSystemFilter.setSystemId(null);
        List<SysSystemGroupSystemDto> groupSystems = systemGroupSystemService.find(systemGroupSystemFilter, null).getContent().stream().filter(groupSystem -> !system.getId().equals(groupSystem.getSystem())).collect(Collectors.toList());
        // Call connector type for every system and load values for given attribute.
        groupSystems.forEach(groupSystem -> {
            SysSystemDto systemInGroup = DtoUtils.getEmbedded(groupSystem, SysSystemGroupSystem_.system, SysSystemDto.class);
            ConnectorType connectorType = getConnectorManager().findConnectorTypeBySystem(systemInGroup);
            if (connectorType != null) {
                List<Object> connectorValuesForSystemInGroup = connectorType.getConnectorValuesByAttribute(uid, objectClass, schemaAttributeName, systemInGroup, connectorObject, groupSystem);
                if (connectorValuesForSystemInGroup != null) {
                    connectorValuesForSystemInGroup.forEach(value -> {
                        if (!connectorValues.contains(value)) {
                            connectorValues.add(value);
                        }
                    });
                }
            }
        });
    } else {
        // System group is not null, so this is sub system in group. We need to get groups by SID.
        Assert.notNull(connectorObject, "The parent connector object cannot be null!");
        IcAttribute sid = connectorObject.getAttributeByName(SID_ATTRIBUTE_KEY);
        Assert.notNull(sid, "SID attribute cannot be null!");
        Object sidValue = sid.getValue();
        Assert.notNull(sidValue, "SID value cannot be null!");
        IdmFormDefinitionDto operationOptionsFormDefinition = this.getSystemService().getOperationOptionsConnectorFormDefinition(system);
        Assert.notNull(operationOptionsFormDefinition, "Operation options form-definition cannot be null!");
        // Find attribute with container with existed users.
        String userContainer = getValueFromConnectorInstance(USER_SEARCH_CONTAINER_KEY, system, operationOptionsFormDefinition);
        Assert.notNull(userContainer, "User container cannot be null!");
        // First we have to find root DN (only DCs).
        String dcs = getRoot(userContainer);
        String foreignSecurityPrincipalsDN = MessageFormat.format("CN={0},CN={1},{2}", convertSidToStr((byte[]) sidValue), FOREIGN_SECURITY_PRINCIPALS_CN, dcs);
        IcConnectorConfiguration connectorConfiguration = getSystemService().getConnectorConfiguration(system);
        IcConnectorInstance connectorInstance = getSystemService().getConnectorInstance(system);
        Set<String> groups = searchGroups("member", connectorConfiguration, connectorInstance, foreignSecurityPrincipalsDN);
        connectorValues.addAll(groups);
    }
    return connectorValues;
}
Also used : ModificationItem(javax.naming.directory.ModificationItem) SSLContext(javax.net.ssl.SSLContext) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SysSystemAttributeMapping_(eu.bcvsolutions.idm.acc.entity.SysSystemAttributeMapping_) IcConnectorInstance(eu.bcvsolutions.idm.ic.api.IcConnectorInstance) Map(java.util.Map) SynchronizationUnlinkedActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationUnlinkedActionType) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) IdmEntityStateService(eu.bcvsolutions.idm.core.api.service.IdmEntityStateService) IdmIdentity(eu.bcvsolutions.idm.core.model.entity.IdmIdentity) IcFilter(eu.bcvsolutions.idm.ic.filter.api.IcFilter) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) Set(java.util.Set) KeyManagementException(java.security.KeyManagementException) ReconciliationMissingAccountActionType(eu.bcvsolutions.idm.acc.domain.ReconciliationMissingAccountActionType) SysSchemaObjectClassFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaObjectClassFilter) ZoneId(java.time.ZoneId) Serializable(java.io.Serializable) SSLSocketFactory(javax.net.ssl.SSLSocketFactory) ByteOrder(java.nio.ByteOrder) SSLException(javax.net.ssl.SSLException) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) Attributes(javax.naming.directory.Attributes) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) Strings(org.apache.logging.log4j.util.Strings) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) SearchResult(javax.naming.directory.SearchResult) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) SysSystemGroupSystem_(eu.bcvsolutions.idm.acc.entity.SysSystemGroupSystem_) Pair(eu.bcvsolutions.idm.core.api.domain.Pair) SysSystemGroupSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemGroupSystemFilter) IdmAttachmentDto(eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto) SynchronizationInactiveOwnerBehaviorType(eu.bcvsolutions.idm.acc.domain.SynchronizationInactiveOwnerBehaviorType) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) InitialDirContext(javax.naming.directory.InitialDirContext) BasicAttribute(javax.naming.directory.BasicAttribute) AbstractDto(eu.bcvsolutions.idm.core.api.dto.AbstractDto) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) Lists(com.google.common.collect.Lists) SSLSession(javax.net.ssl.SSLSession) SynchronizationLinkedActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationLinkedActionType) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) Context(javax.naming.Context) IcAttributeInfo(eu.bcvsolutions.idm.ic.api.IcAttributeInfo) IcFilterBuilder(eu.bcvsolutions.idm.ic.filter.impl.IcFilterBuilder) CoreException(eu.bcvsolutions.idm.core.api.exception.CoreException) IcConnectorKey(eu.bcvsolutions.idm.ic.api.IcConnectorKey) DirContext(javax.naming.directory.DirContext) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) NameAlreadyBoundException(javax.naming.NameAlreadyBoundException) SystemMappingEvent(eu.bcvsolutions.idm.acc.event.SystemMappingEvent) IOException(java.io.IOException) FileUtils(org.apache.commons.io.FileUtils) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) UnknownHostException(java.net.UnknownHostException) File(java.io.File) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) IcConnectorConfigurationImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) Paths(java.nio.file.Paths) X509TrustManager(javax.net.ssl.X509TrustManager) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) IdmIdentity_(eu.bcvsolutions.idm.core.model.entity.IdmIdentity_) X509Certificate(java.security.cert.X509Certificate) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemGroupSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemGroupSystemDto) Date(java.util.Date) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) SSLSocket(javax.net.ssl.SSLSocket) TrustManager(javax.net.ssl.TrustManager) NamingException(javax.naming.NamingException) AuthenticationException(javax.naming.AuthenticationException) ByteBuffer(java.nio.ByteBuffer) SysConnectorKeyDto(eu.bcvsolutions.idm.acc.dto.SysConnectorKeyDto) Attribute(javax.naming.directory.Attribute) ByteArrayInputStream(java.io.ByteArrayInputStream) SysSchemaAttribute_(eu.bcvsolutions.idm.acc.entity.SysSchemaAttribute_) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) SynchronizationMissingEntityActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationMissingEntityActionType) IdmFormAttributeService(eu.bcvsolutions.idm.core.eav.api.service.IdmFormAttributeService) SysSyncConfigService(eu.bcvsolutions.idm.acc.service.api.SysSyncConfigService) ImmutableMap(com.google.common.collect.ImmutableMap) BasicAttributes(javax.naming.directory.BasicAttributes) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) IdmEntityStateFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmEntityStateFilter) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) List(java.util.List) Certificate(java.security.cert.Certificate) NamingEnumeration(javax.naming.NamingEnumeration) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) CertificateUtils(eu.bcvsolutions.idm.core.api.utils.CertificateUtils) HashMap(java.util.HashMap) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ConnectorException(org.identityconnectors.framework.common.exceptions.ConnectorException) SearchControls(javax.naming.directory.SearchControls) PersistentType(eu.bcvsolutions.idm.core.eav.api.domain.PersistentType) MessageFormat(java.text.MessageFormat) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) EntityStateManager(eu.bcvsolutions.idm.core.api.service.EntityStateManager) IcObjectClassInfo(eu.bcvsolutions.idm.ic.api.IcObjectClassInfo) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) SysSystemGroupSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemGroupSystemService) Hashtable(java.util.Hashtable) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) AttachmentManager(eu.bcvsolutions.idm.core.ecm.api.service.AttachmentManager) CertificateException(java.security.cert.CertificateException) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) SpinalCase(eu.bcvsolutions.idm.core.api.utils.SpinalCase) SystemGroupType(eu.bcvsolutions.idm.acc.domain.SystemGroupType) Component(org.springframework.stereotype.Component) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) CommunicationException(javax.naming.CommunicationException) Comparator(java.util.Comparator) DigestUtils(org.apache.commons.codec.digest.DigestUtils) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) ResultModel(eu.bcvsolutions.idm.core.api.dto.ResultModel) Transactional(org.springframework.transaction.annotation.Transactional) Assert(org.springframework.util.Assert) IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) SysSystemGroupSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemGroupSystemFilter) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) SysSystemGroupSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemGroupSystemDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorInstance(eu.bcvsolutions.idm.ic.api.IcConnectorInstance) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) UUID(java.util.UUID)

Example 4 with ConnectorType

use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.

the class AbstractProvisioningProcessor method process.

/**
 * Prepare provisioning operation execution
 */
@Override
public EventResult<SysProvisioningOperationDto> process(EntityEvent<SysProvisioningOperationDto> event) {
    SysProvisioningOperationDto provisioningOperation = event.getContent();
    SysSystemDto system = systemService.get(provisioningOperation.getSystem());
    IcConnectorObject connectorObject = provisioningOperation.getProvisioningContext().getConnectorObject();
    IcObjectClass objectClass = connectorObject.getObjectClass();
    SysSystemEntityDto systemEntity = systemEntityService.getByProvisioningOperation(provisioningOperation);
    // If exists password in attributes and system support password filter set also echo
    boolean processEcho = false;
    List<UUID> accountIds = null;
    LOG.debug("Start provisioning operation [{}] for object with uid [{}] and connector object [{}]", provisioningOperation.getOperationType(), systemEntity.getUid(), objectClass.getType());
    // Find connector identification persisted in system
    if (system.getConnectorKey() == null) {
        throw new ProvisioningException(AccResultCode.CONNECTOR_KEY_FOR_SYSTEM_NOT_FOUND, ImmutableMap.of("system", system.getName()));
    }
    // Load connector configuration from connectorType.
    ConnectorType connectorType = connectorManager.findConnectorTypeBySystem(system);
    IcConnectorConfiguration connectorConfig = connectorType.getConnectorConfiguration(system);
    // 
    try {
        provisioningOperation = provisioningOperationService.saveOperation(provisioningOperation);
        // convert confidential string to guarded strings before provisioning realization
        connectorObject = provisioningOperationService.getFullConnectorObject(provisioningOperation);
        provisioningOperation.getProvisioningContext().setConnectorObject(connectorObject);
        for (IcAttribute attribute : connectorObject.getAttributes()) {
            if (attribute.getName().equals(ProvisioningService.PASSWORD_SCHEMA_PROPERTY_NAME) && attribute instanceof IcPasswordAttribute) {
                if (this.hasSystemPasswordFilter(system)) {
                    IcPasswordAttributeImpl password = ((IcPasswordAttributeImpl) attribute);
                    accountIds = getAccounts(system.getId(), systemEntity.getId());
                    for (UUID accountId : accountIds) {
                        passwordFilterManager.setEchoForChange(accountId, password.getPasswordValue());
                    }
                    processEcho = true;
                }
                break;
            }
        }
        // 
        IcUidAttribute resultUid = processInternal(provisioningOperation, connectorConfig);
        // update system entity, when identifier on target system differs
        if (resultUid != null && resultUid.getUidValue() != null) {
            if (!systemEntity.getUid().equals(resultUid.getUidValue()) || systemEntity.isWish()) {
                systemEntity.setUid(resultUid.getUidValue());
                systemEntity.setWish(false);
                systemEntity = systemEntityService.save(systemEntity);
                LOG.info("UID was changed. System entity with uid [{}] was updated", systemEntity.getUid());
            }
        } else {
            // e.g. update doesn't return
            if (systemEntity.isWish()) {
                systemEntity.setWish(false);
                systemEntity = systemEntityService.save(systemEntity);
                LOG.info("UID was changed. System entity with uid [{}] was updated", systemEntity.getUid());
            }
        }
        provisioningOperation = provisioningOperationService.handleSuccessful(provisioningOperation);
    } catch (Exception ex) {
        provisioningOperation = provisioningOperationService.handleFailed(provisioningOperation, ex);
        if (processEcho) {
            // Clear echo record about password change
            accountIds.forEach(accountId -> {
                passwordFilterManager.clearChangedEcho(accountId);
            });
        }
    }
    // set operation back to content
    event.setContent(provisioningOperation);
    return new DefaultEventResult<>(event, this);
}
Also used : IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) IcPasswordAttribute(eu.bcvsolutions.idm.ic.api.IcPasswordAttribute) ProvisioningEventType(eu.bcvsolutions.idm.acc.domain.ProvisioningEventType) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) IcPasswordAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcPasswordAttributeImpl) Autowired(org.springframework.beans.factory.annotation.Autowired) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) Enabled(eu.bcvsolutions.idm.core.security.api.domain.Enabled) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) ArrayList(java.util.ArrayList) CoreEvent(eu.bcvsolutions.idm.core.api.event.CoreEvent) PasswordFilterManager(eu.bcvsolutions.idm.acc.service.api.PasswordFilterManager) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) Map(java.util.Map) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) EventResult(eu.bcvsolutions.idm.core.api.event.EventResult) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) AccModuleDescriptor(eu.bcvsolutions.idm.acc.AccModuleDescriptor) AbstractEntityEventProcessor(eu.bcvsolutions.idm.core.api.event.AbstractEntityEventProcessor) ImmutableMap(com.google.common.collect.ImmutableMap) SysProvisioningOperationService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningOperationService) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) Set(java.util.Set) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) UUID(java.util.UUID) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) List(java.util.List) AccAccountService(eu.bcvsolutions.idm.acc.service.api.AccAccountService) ConnectorManager(eu.bcvsolutions.idm.acc.service.api.ConnectorManager) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) ProvisioningService(eu.bcvsolutions.idm.acc.service.api.ProvisioningService) Optional(java.util.Optional) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) AccAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccAccountFilter) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) Assert(org.springframework.util.Assert) IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) IcPasswordAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcPasswordAttributeImpl) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) IcPasswordAttribute(eu.bcvsolutions.idm.ic.api.IcPasswordAttribute) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) UUID(java.util.UUID) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)

Example 5 with ConnectorType

use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.

the class AdGroupConnectorTypeTest method testStepOneByMemberSystem.

@Test
public void testStepOneByMemberSystem() {
    // Create system with members.
    SysSystemDto memberSystemDto = createMemberSystem();
    SysSystemMappingFilter mappingFilter = new SysSystemMappingFilter();
    mappingFilter.setSystemId(memberSystemDto.getId());
    mappingFilter.setOperationType(SystemOperationType.PROVISIONING);
    mappingFilter.setEntityType(SystemEntityType.IDENTITY);
    SysSystemMappingDto mappingDto = mappingService.find(mappingFilter, null).getContent().stream().findFirst().orElse(null);
    assertNotNull(mappingDto);
    ConnectorType connectorType = connectorManager.getConnectorType(MockAdGroupConnectorType.NAME);
    ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
    connectorTypeDto.setReopened(false);
    connectorManager.load(connectorTypeDto);
    assertNotNull(connectorTypeDto);
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.SYSTEM_NAME, this.getHelper().createName());
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.MEMBER_SYSTEM_MAPPING, mappingDto.getId().toString());
    connectorTypeDto.setWizardStepName(MockAdGroupConnectorType.STEP_ONE);
    // Execute the first step.
    ConnectorTypeDto stepExecutedResult = connectorManager.execute(connectorTypeDto);
    BaseDto systemDto = stepExecutedResult.getEmbedded().get(MockAdGroupConnectorType.SYSTEM_DTO_KEY);
    assertNotNull("System ID cannot be null!", systemDto);
    SysSystemDto system = systemService.get(systemDto.getId());
    assertNotNull(system);
    // Clean
    systemService.delete((SysSystemDto) systemDto);
    systemService.delete(memberSystemDto);
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) AdGroupConnectorType(eu.bcvsolutions.idm.acc.connector.AdGroupConnectorType) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) MockAdGroupConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdGroupConnectorType) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) BaseDto(eu.bcvsolutions.idm.core.api.dto.BaseDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

ConnectorType (eu.bcvsolutions.idm.acc.service.api.ConnectorType)58 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)56 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)45 Test (org.junit.Test)45 ConnectorTypeDto (eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto)41 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)25 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)24 MockAdUserConnectorType (eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType)22 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)19 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)19 BaseDto (eu.bcvsolutions.idm.core.api.dto.BaseDto)18 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)17 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)16 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)16 SysRoleSystemFilter (eu.bcvsolutions.idm.acc.dto.filter.SysRoleSystemFilter)16 MockCrossDomainAdUserConnectorType (eu.bcvsolutions.idm.acc.service.impl.mock.MockCrossDomainAdUserConnectorType)16 UUID (java.util.UUID)16 ProvisioningAttributeDto (eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto)15 AdGroupConnectorType (eu.bcvsolutions.idm.acc.connector.AdGroupConnectorType)14 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)14