Search in sources :

Example 1 with IcConnectorConfigurationImpl

use of eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl in project CzechIdMng by bcvsolutions.

the class ConnIdIcConvertUtil method convertConnIdConnectorConfiguration.

public static IcConnectorConfiguration convertConnIdConnectorConfiguration(APIConfiguration conf) {
    if (conf == null) {
        return null;
    }
    IcConnectorConfigurationImpl dto = new IcConnectorConfigurationImpl();
    dto.setConnectorPoolingSupported(conf.isConnectorPoolingSupported());
    dto.setProducerBufferSize(conf.getProducerBufferSize());
    ConfigurationProperties properties = conf.getConfigurationProperties();
    IcConfigurationPropertiesImpl propertiesDto = new IcConfigurationPropertiesImpl();
    if (properties != null && properties.getPropertyNames() != null) {
        List<String> propertyNames = properties.getPropertyNames();
        for (String name : propertyNames) {
            ConfigurationProperty property = properties.getProperty(name);
            IcConfigurationPropertyImpl propertyDto = (IcConfigurationPropertyImpl) convertConnIdConfigurationProperty(property);
            if (propertiesDto != null) {
                propertiesDto.getProperties().add(propertyDto);
            }
        }
    }
    dto.setConfigurationProperties(propertiesDto);
    IcObjectPoolConfigurationImpl connectorPoolConfiguration = (IcObjectPoolConfigurationImpl) convertConnIdPoolConfiguration(conf.getConnectorPoolConfiguration());
    dto.setConnectorPoolConfiguration(connectorPoolConfiguration);
    dto.setOperationOptions(Collections.emptyMap());
    return dto;
}
Also used : ConfigurationProperty(org.identityconnectors.framework.api.ConfigurationProperty) IcConfigurationProperty(eu.bcvsolutions.idm.ic.api.IcConfigurationProperty) IcConnectorConfigurationImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl) IcObjectPoolConfigurationImpl(eu.bcvsolutions.idm.ic.impl.IcObjectPoolConfigurationImpl) ConfigurationProperties(org.identityconnectors.framework.api.ConfigurationProperties) IcConfigurationProperties(eu.bcvsolutions.idm.ic.api.IcConfigurationProperties) GuardedString(org.identityconnectors.common.security.GuardedString) IcConfigurationPropertiesImpl(eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertiesImpl) IcConfigurationPropertyImpl(eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertyImpl)

Example 2 with IcConnectorConfigurationImpl

use of eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl in project CzechIdMng by bcvsolutions.

the class CzechIdMIcConfigurationService method initDefaultConfiguration.

/**
 * Create instance of default connector configuration
 *
 * @param configurationClass
 * @return
 */
private IcConnectorConfiguration initDefaultConfiguration(Class<? extends ConfigurationClass> configurationClass) {
    try {
        ConfigurationClass configurationClassInstance = configurationClass.getDeclaredConstructor().newInstance();
        List<IcConfigurationProperty> properties = new ArrayList<>();
        PropertyDescriptor[] descriptors = Introspector.getBeanInfo(configurationClass).getPropertyDescriptors();
        Lists.newArrayList(descriptors).stream().forEach(descriptor -> {
            Method readMethod = descriptor.getReadMethod();
            String propertyName = descriptor.getName();
            ConfigurationClassProperty property = readMethod.getAnnotation(ConfigurationClassProperty.class);
            if (property != null) {
                IcConfigurationPropertyImpl icProperty = (IcConfigurationPropertyImpl) CzechIdMIcConvertUtil.convertConfigurationProperty(property);
                icProperty.setName(propertyName);
                icProperty.setType(readMethod.getGenericReturnType().getTypeName());
                try {
                    icProperty.setValue(readMethod.invoke(configurationClassInstance));
                } catch (IllegalArgumentException | ReflectiveOperationException e) {
                    throw new CoreException("Cannot read value of connector configuration property!", e);
                }
                properties.add(icProperty);
            }
        });
        // Sort by order
        properties.sort(Comparator.comparing(IcConfigurationProperty::getOrder));
        IcConfigurationPropertiesImpl icProperties = new IcConfigurationPropertiesImpl();
        icProperties.setProperties(properties);
        IcConnectorConfigurationImpl configuration = new IcConnectorConfigurationImpl();
        configuration.setConnectorPoolingSupported(false);
        configuration.setConfigurationProperties(icProperties);
        return configuration;
    } catch (IntrospectionException | ReflectiveOperationException e) {
        throw new CoreException("Cannot read connector configuration property!", e);
    }
}
Also used : ConfigurationClass(eu.bcvsolutions.idm.core.api.domain.ConfigurationClass) IcConnectorConfigurationImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl) PropertyDescriptor(java.beans.PropertyDescriptor) ArrayList(java.util.ArrayList) IntrospectionException(java.beans.IntrospectionException) Method(java.lang.reflect.Method) IcConfigurationPropertiesImpl(eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertiesImpl) ConfigurationClassProperty(eu.bcvsolutions.idm.core.api.domain.ConfigurationClassProperty) CoreException(eu.bcvsolutions.idm.core.api.exception.CoreException) IcConfigurationProperty(eu.bcvsolutions.idm.ic.api.IcConfigurationProperty) IcConfigurationPropertyImpl(eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertyImpl)

Example 3 with IcConnectorConfigurationImpl

use of eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl in project CzechIdMng by bcvsolutions.

the class AdUserConnectorType method searchGroups.

protected Set<String> searchGroups(String memberAttribute, IcConnectorConfiguration icConfig, IcConnectorInstance connectorInstance, String dn) {
    // Disable filter validations for connector results (validation does not work for AD properly).
    Map<String, Object> systemOperationOptions = icConfig.getSystemOperationOptions();
    if (systemOperationOptions == null) {
        systemOperationOptions = new HashMap<>();
    }
    systemOperationOptions.put(IcConnectorConfiguration.DISABLE_FILTER_VALIDATION_KEY, Boolean.TRUE);
    if (icConfig instanceof IcConnectorConfigurationImpl) {
        IcConnectorConfigurationImpl config = (IcConnectorConfigurationImpl) icConfig;
        config.setOperationOptions(systemOperationOptions);
    }
    Set<String> groups = Sets.newHashSet();
    IcAttributeImpl dnFilterAttribute = new IcAttributeImpl(memberAttribute, dn);
    IcFilter icFilter = IcFilterBuilder.equalTo(dnFilterAttribute);
    IcObjectClass groupObjectClass = new IcObjectClassImpl(IcObjectClassInfo.GROUP);
    connectorFacade.search(connectorInstance, icConfig, groupObjectClass, icFilter, connectorObject -> {
        if (connectorObject != null) {
            IcAttribute attribute = connectorObject.getAttributeByName(IcAttributeInfo.NAME);
            if (attribute != null) {
                groups.add((String) attribute.getValue());
            }
        }
        return true;
    });
    return groups;
}
Also used : IcConnectorConfigurationImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IcFilter(eu.bcvsolutions.idm.ic.filter.api.IcFilter)

Example 4 with IcConnectorConfigurationImpl

use of eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl in project CzechIdMng by bcvsolutions.

the class RoleSynchronizationExecutor method resolveAssignRole.

private boolean resolveAssignRole(boolean isNew, SynchronizationContext context, IdmRoleDto roleDto, SysSyncRoleConfigDto config, SysSyncItemLogDto logItem, IcConnectorObject connectorObject, SysSystemAttributeMappingDto memberOfAttributeDto, SysSchemaObjectClassDto schemaObjectClassDto) {
    // Find attribute for get members (DNs)
    SysSystemAttributeMappingDto roleMembersAttributeDto = context.getMappedAttributes().stream().filter(attribute -> !attribute.isDisabledAttribute() && attribute.isEntityAttribute() && ROLE_MEMBERS_FIELD.equals(attribute.getIdmPropertyName())).findFirst().orElse(null);
    Assert.notNull(roleMembersAttributeDto, "Mapped attribute with role's members was not found. Please create it!");
    if (!isNew && AttributeMappingStrategyType.CREATE == roleMembersAttributeDto.getStrategyType()) {
        addToItemLog(logItem, "The attribute with role's members has strategy set to 'Set only for new entity'. Role isn't new, so resolving controlling an assignment of roles to users by the external system will be skipped for this role.");
    } else {
        addToItemLog(logItem, "Controlling an assignment of roles to users by the external system is activated.");
        Object membersObj = this.getValueByMappedAttribute(roleMembersAttributeDto, connectorObject.getAttributes(), context);
        if (membersObj == null) {
            membersObj = Lists.newArrayList();
        }
        if (membersObj instanceof String) {
            membersObj = Lists.newArrayList(membersObj);
        }
        Assert.isInstanceOf(List.class, membersObj, "The value from attribute with role's members must be List of Strings!");
        @SuppressWarnings("unchecked") List<String> members = (List<String>) membersObj;
        SysRoleSystemDto roleSystemDto = findRoleSystemDto(roleDto, memberOfAttributeDto, schemaObjectClassDto);
        if (roleSystemDto == null) {
            addToItemLog(logItem, "Relation between this role and system was not found. Assigning of role to users will be skip for this role.");
            return false;
        }
        SysRoleSystemAttributeDto memberAttribute = findMemberAttribute(memberOfAttributeDto, schemaObjectClassDto, roleSystemDto);
        if (memberAttribute == null) {
            addToItemLog(logItem, "The member attribute between this role and system was not found. Assigning of role to users will be skip for this role.");
            return false;
        }
        // Find identities with this role.
        IdmIdentityRoleFilter identityRoleFilter = new IdmIdentityRoleFilter();
        identityRoleFilter.setRoleId(roleDto.getId());
        List<IdmIdentityRoleDto> existsIdentityRoleDtos = identityRoleService.find(identityRoleFilter, null).getContent();
        // Get cache with users (DN vs UID).
        Map<String, String> usersUidCache = getUserUidCache();
        SysSchemaAttributeDto memberIdentifierAttribute = lookupService.lookupEmbeddedDto(config, SysSyncRoleConfig_.memberIdentifierAttribute);
        Assert.notNull(memberIdentifierAttribute, "User identifier attribute cannot be null!");
        Set<String> membersUid = Sets.newHashSet();
        Set<UUID> membersContractIds = Sets.newHashSet();
        // Call user system for every member (if isn't already in the cache).
        SysSystemDto userSystemDto = systemService.get(roleSystemDto.getSystem());
        IcConnectorConfiguration icConfig = systemService.getConnectorConfiguration(userSystemDto);
        IcConnectorInstance connectorInstance = systemService.getConnectorInstance(userSystemDto);
        IcObjectClass objectClass = new IcObjectClassImpl(schemaObjectClassDto.getObjectClassName());
        if (icConfig instanceof IcConnectorConfigurationImpl) {
            // Enable pooling - a performance reason.
            IcConnectorConfigurationImpl icConfigImpl = (IcConnectorConfigurationImpl) icConfig;
            icConfigImpl.setConnectorPoolingSupported(true);
        }
        final int[] count = { 0 };
        for (String member : members) {
            if (!transformDnToUid(config, usersUidCache, memberIdentifierAttribute, membersUid, icConfig, connectorInstance, objectClass, count, member)) {
                return false;
            }
        }
        count[0] = 0;
        membersUid.forEach(uid -> assignMissingIdentityRoles(roleDto, config, logItem, existsIdentityRoleDtos, membersContractIds, userSystemDto, count, uid, context));
        if (!checkForCancelAndFlush(config)) {
            return false;
        }
        // Remove redundant identity roles.
        List<IdmIdentityRoleDto> redundantIdentityRoles = existsIdentityRoleDtos.stream().filter(existsIdentityRole -> !membersContractIds.contains(existsIdentityRole.getIdentityContract())).collect(Collectors.toList());
        count[0] = 0;
        redundantIdentityRoles.forEach(redundantIdentityRole -> removeRedundantIdentityRoles(roleDto, config, logItem, count, redundantIdentityRole));
    }
    return true;
}
Also used : IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) Autowired(org.springframework.beans.factory.annotation.Autowired) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) EntityAccountDto(eu.bcvsolutions.idm.acc.dto.EntityAccountDto) SysSystemAttributeMapping_(eu.bcvsolutions.idm.acc.entity.SysSystemAttributeMapping_) IcConnectorInstance(eu.bcvsolutions.idm.ic.api.IcConnectorInstance) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) EntityAccountService(eu.bcvsolutions.idm.acc.service.api.EntityAccountService) Map(java.util.Map) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) AccRoleAccountDto(eu.bcvsolutions.idm.acc.dto.AccRoleAccountDto) IdmIdentityContractService(eu.bcvsolutions.idm.core.api.service.IdmIdentityContractService) IcFilter(eu.bcvsolutions.idm.ic.filter.api.IcFilter) Set(java.util.Set) Serializable(java.io.Serializable) AttributeMapping(eu.bcvsolutions.idm.acc.domain.AttributeMapping) IdmRoleCatalogueService(eu.bcvsolutions.idm.core.api.service.IdmRoleCatalogueService) SysRoleSystemAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysRoleSystemAttributeFilter) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) IdmRoleRequest_(eu.bcvsolutions.idm.core.model.entity.IdmRoleRequest_) IdmRoleCatalogueRole_(eu.bcvsolutions.idm.core.model.entity.IdmRoleCatalogueRole_) RoleEvent(eu.bcvsolutions.idm.core.model.event.RoleEvent) SysRoleSystemFilter(eu.bcvsolutions.idm.acc.dto.filter.SysRoleSystemFilter) AbstractDto(eu.bcvsolutions.idm.core.api.dto.AbstractDto) Lists(com.google.common.collect.Lists) LookupService(eu.bcvsolutions.idm.core.api.service.LookupService) SysSystemEntityFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemEntityFilter) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) RoleEventType(eu.bcvsolutions.idm.core.model.event.RoleEvent.RoleEventType) SysRoleSystemAttributeService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemAttributeService) SysSyncActionLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto) IcFilterBuilder(eu.bcvsolutions.idm.ic.filter.impl.IcFilterBuilder) IdmRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleService) OperationState(eu.bcvsolutions.idm.core.api.domain.OperationState) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) RoleRequestState(eu.bcvsolutions.idm.core.api.domain.RoleRequestState) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) AccRoleAccountService(eu.bcvsolutions.idm.acc.service.api.AccRoleAccountService) IdmIdentityContract_(eu.bcvsolutions.idm.core.model.entity.IdmIdentityContract_) SysSyncRoleConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto) IcConnectorConfigurationImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl) SynchronizationContext(eu.bcvsolutions.idm.acc.domain.SynchronizationContext) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SynchronizationEntityExecutor(eu.bcvsolutions.idm.acc.service.api.SynchronizationEntityExecutor) ConceptRoleRequestOperation(eu.bcvsolutions.idm.core.api.domain.ConceptRoleRequestOperation) OperationResultType(eu.bcvsolutions.idm.acc.domain.OperationResultType) RoleType(eu.bcvsolutions.idm.core.api.domain.RoleType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) AccRoleAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccRoleAccountFilter) IdmRoleRequestService(eu.bcvsolutions.idm.core.api.service.IdmRoleRequestService) SysRoleSystemService(eu.bcvsolutions.idm.acc.service.api.SysRoleSystemService) SysSchemaAttribute_(eu.bcvsolutions.idm.acc.entity.SysSchemaAttribute_) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IdmRoleCatalogueRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueRoleFilter) ImmutableMap(com.google.common.collect.ImmutableMap) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) IdmRoleCatalogue_(eu.bcvsolutions.idm.core.model.entity.IdmRoleCatalogue_) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) List(java.util.List) EntityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.EntityAccountFilter) IdmRoleCatalogueFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueFilter) AccIdentityAccountService(eu.bcvsolutions.idm.acc.service.api.AccIdentityAccountService) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) AccAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccAccountFilter) DefaultResultModel(eu.bcvsolutions.idm.core.api.dto.DefaultResultModel) RoleRequestApprovalProcessor(eu.bcvsolutions.idm.core.model.event.processor.role.RoleRequestApprovalProcessor) IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) IdmIdentityRole_(eu.bcvsolutions.idm.core.model.entity.IdmIdentityRole_) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) HashMap(java.util.HashMap) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AtomicReference(java.util.concurrent.atomic.AtomicReference) MessageFormat(java.text.MessageFormat) SynchronizationActionType(eu.bcvsolutions.idm.acc.domain.SynchronizationActionType) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) OperationResultDto(eu.bcvsolutions.idm.core.api.dto.OperationResultDto) CorrelationFilter(eu.bcvsolutions.idm.core.api.dto.filter.CorrelationFilter) IdmRoleCatalogueRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueRoleDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) IdmIdentityRoleService(eu.bcvsolutions.idm.core.api.service.IdmIdentityRoleService) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSyncRoleConfig_(eu.bcvsolutions.idm.acc.entity.SysSyncRoleConfig_) IdmRoleCatalogueRoleService(eu.bcvsolutions.idm.core.api.service.IdmRoleCatalogueRoleService) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) Component(org.springframework.stereotype.Component) RoleRequestEvent(eu.bcvsolutions.idm.core.model.event.RoleRequestEvent) ProvisioningService(eu.bcvsolutions.idm.acc.service.api.ProvisioningService) SysSyncItemLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncItemLogDto) Assert(org.springframework.util.Assert) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcConnectorConfigurationImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) IcConnectorInstance(eu.bcvsolutions.idm.ic.api.IcConnectorInstance) SysRoleSystemDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) List(java.util.List) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) UUID(java.util.UUID)

Example 5 with IcConnectorConfigurationImpl

use of eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemService method getConnectorConfiguration.

@Override
@Transactional
public IcConnectorConfiguration getConnectorConfiguration(SysSystemDto system) {
    Assert.notNull(system, "System is required.");
    if (system.getConnectorKey() == null) {
        return null;
    }
    IcConnectorConfiguration connectorConfig = null;
    // load connector properties, different between local and remote
    IcConnectorInstance connectorInstance = getConnectorInstance(system);
    connectorConfig = icConfigurationFacade.getConnectorConfiguration(connectorInstance);
    // load filled form values
    IdmFormDefinitionDto formDefinition = getConnectorFormDefinition(connectorInstance);
    IdmFormInstanceDto formInstance = getFormService().getFormInstance(system, formDefinition);
    Map<String, List<IdmFormValueDto>> attributeValues = formInstance.toValueMap();
    // fill connector configuration from form values
    IcConnectorConfigurationImpl configuration = null;
    if (SysSystemService.CONNECTOR_FRAMEWORK_CZECHIDM.equals(connectorInstance.getConnectorKey().getFramework())) {
        // For CzechIdM connector framework is needs system ID (exactly for virtual systems).
        configuration = new IcConnectorConfigurationCzechIdMImpl();
        ((IcConnectorConfigurationCzechIdMImpl) configuration).setSystemId(system.getId());
    } else {
        configuration = new IcConnectorConfigurationImpl();
    }
    // Create configuration for pool
    fillPoolingConnectorConfiguration(configuration, connectorInstance, system);
    // Load operation options
    configuration.setOperationOptions(getOperationOptionsForSystem(connectorInstance, system));
    IcConfigurationProperties properties = new IcConfigurationPropertiesImpl();
    configuration.setConfigurationProperties(properties);
    // 
    for (short seq = 0; seq < connectorConfig.getConfigurationProperties().getProperties().size(); seq++) {
        IcConfigurationProperty propertyConfig = connectorConfig.getConfigurationProperties().getProperties().get(seq);
        IdmFormAttributeDto formAttribute = formInstance.getMappedAttributeByCode(propertyConfig.getName());
        List<IdmFormValueDto> eavAttributeValues = attributeValues.get(formAttribute.getCode());
        // create property instance from configuration
        IcConfigurationProperty property = formPropertyManager.toConnectorProperty(propertyConfig, eavAttributeValues);
        if (property.getValue() != null) {
            // only filled values to configuration
            properties.getProperties().add(property);
        }
    }
    return configuration;
}
Also used : IcConnectorConfiguration(eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration) IdmFormInstanceDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormInstanceDto) IcConnectorConfigurationImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IcConfigurationPropertiesImpl(eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertiesImpl) IcConfigurationProperties(eu.bcvsolutions.idm.ic.api.IcConfigurationProperties) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IcConfigurationProperty(eu.bcvsolutions.idm.ic.api.IcConfigurationProperty) IcConnectorConfigurationCzechIdMImpl(eu.bcvsolutions.idm.ic.czechidm.domain.IcConnectorConfigurationCzechIdMImpl) IcConnectorInstance(eu.bcvsolutions.idm.ic.api.IcConnectorInstance) List(java.util.List) ArrayList(java.util.ArrayList) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

IcConnectorConfigurationImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorConfigurationImpl)5 IcConfigurationProperty (eu.bcvsolutions.idm.ic.api.IcConfigurationProperty)2 IcConnectorConfiguration (eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration)2 IcConnectorInstance (eu.bcvsolutions.idm.ic.api.IcConnectorInstance)2 IcConfigurationPropertiesImpl (eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertiesImpl)2 IcConfigurationPropertyImpl (eu.bcvsolutions.idm.ic.impl.IcConfigurationPropertyImpl)2 List (java.util.List)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 Lists (com.google.common.collect.Lists)1 Sets (com.google.common.collect.Sets)1 AccResultCode (eu.bcvsolutions.idm.acc.domain.AccResultCode)1 AttributeMapping (eu.bcvsolutions.idm.acc.domain.AttributeMapping)1 AttributeMappingStrategyType (eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType)1 OperationResultType (eu.bcvsolutions.idm.acc.domain.OperationResultType)1 SynchronizationActionType (eu.bcvsolutions.idm.acc.domain.SynchronizationActionType)1 SynchronizationContext (eu.bcvsolutions.idm.acc.domain.SynchronizationContext)1 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)1 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)1 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)1 AccRoleAccountDto (eu.bcvsolutions.idm.acc.dto.AccRoleAccountDto)1