Search in sources :

Example 31 with SysSchemaAttributeDto

use of eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto in project CzechIdMng by bcvsolutions.

the class SysSystemMappingServiceValidationTest method createSchemaAttribute.

/*
	 * Creates and returns attribute schema
	 * 
	 * @param schemaObject
	 * @return schemaAttribute
	*/
private SysSchemaAttributeDto createSchemaAttribute(UUID schemaObject) {
    SysSchemaAttributeDto schemaAttribute = new SysSchemaAttributeDto();
    schemaAttribute.setName("name_test" + System.currentTimeMillis());
    schemaAttribute.setClassType("String");
    schemaAttribute.setObjectClass(schemaObject);
    return schemaAttributeService.save(schemaAttribute);
}
Also used : SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)

Example 32 with SysSchemaAttributeDto

use of eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto in project CzechIdMng by bcvsolutions.

the class AdUserConnectorType method createSchemaAttribute.

/**
 * Create schema attribute.
 */
protected SysSchemaAttributeDto createSchemaAttribute(SysSchemaObjectClassDto schemaDto, String attributeName, String type, boolean returnByDefault, boolean updateable, boolean multivalued) {
    SysSchemaAttributeDto attribute;
    attribute = new SysSchemaAttributeDto();
    attribute.setName(attributeName);
    attribute.setClassType(type);
    attribute.setObjectClass(schemaDto.getId());
    attribute.setCreateable(true);
    attribute.setReadable(true);
    attribute.setMultivalued(multivalued);
    attribute.setReturnedByDefault(returnByDefault);
    attribute.setUpdateable(updateable);
    return schemaAttributeService.save(attribute);
}
Also used : SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)

Example 33 with SysSchemaAttributeDto

use of eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto in project CzechIdMng by bcvsolutions.

the class PrepareConnectorObjectProcessor method processCreate.

/**
 * Create object on target system
 *
 * @param provisioningOperation
 */
private void processCreate(SysProvisioningOperationDto provisioningOperation) {
    SysSystemDto system = systemService.get(provisioningOperation.getSystem());
    ProvisioningContext provisioningContext = provisioningOperation.getProvisioningContext();
    IcConnectorObject connectorObject = provisioningContext.getConnectorObject();
    // 
    // prepare provisioning attributes from account attributes
    Map<ProvisioningAttributeDto, Object> fullAccountObject = provisioningOperationService.getFullAccountObject(provisioningOperation);
    if (fullAccountObject != null) {
        connectorObject.getAttributes().clear();
        SysSystemMappingDto mapping = getMapping(system, provisioningOperation.getEntityType());
        SysSchemaObjectClassDto schemaObjectClassDto = schemaObjectClassService.get(mapping.getObjectClass());
        List<SysSchemaAttributeDto> schemaAttributes = findSchemaAttributes(system, schemaObjectClassDto);
        List<SysSystemAttributeMappingDto> passwordAttributes = attributeMappingService.getAllPasswordAttributes(system.getId(), mapping.getId());
        GuardedString generatedPassword = null;
        // If exists at least one password attribute generate password and try set echos for current system
        if (!passwordAttributes.isEmpty()) {
            // Check if exists a uniform password for this entity. If yes, then use it.
            if (provisioningOperation.getEntityIdentifier() != null && provisioningOperation.getEntityType() != null && provisioningOperation.getSystem() != null && provisioningOperation.getTransactionId() != null) {
                if (uniformPasswordManager.isSystemInUniformPasswordAgenda(provisioningOperation.getSystem())) {
                    generatedPassword = uniformPasswordManager.generateUniformPassword(provisioningOperation.getEntityIdentifier(), provisioningOperation.getEntityType().getEntityType(), provisioningOperation.getTransactionId());
                }
            }
            if (generatedPassword == null) {
                generatedPassword = generatePassword(system);
            }
        } else {
            generatedPassword = null;
        }
        // Found all given password from original provisioning context, these passwords will be skipped
        List<ProvisioningAttributeDto> givenPasswords = provisioningContext.getAccountObject().keySet().stream().filter(provisioningAtt -> provisioningAtt.isPasswordAttribute()).collect(Collectors.toList());
        // Iterate over all password attributes founded for system and mapping
        for (SysSystemAttributeMappingDto passwordAttribute : passwordAttributes) {
            // Password may be add by another process or execute existing provisioning operation, these password skip
            SysSchemaAttributeDto schemaByPasswordAttribute = DtoUtils.getEmbedded(passwordAttribute, SysSystemAttributeMapping_.schemaAttribute, SysSchemaAttributeDto.class);
            Optional<ProvisioningAttributeDto> findAnyPassword = // 
            givenPasswords.stream().filter(givenPassword -> givenPassword.getSchemaAttributeName().equals(// 
            schemaByPasswordAttribute.getName())).findAny();
            if (findAnyPassword.isPresent()) {
                continue;
            }
            // All non existing passwords in provisioning context will be added and
            // transformed. Then will be set as new attribute into fullAccountObject
            GuardedString transformPassword = transformPassword(provisioningOperation, system.getId(), passwordAttribute, generatedPassword);
            SysSchemaAttributeDto schemaAttribute = // 
            schemaAttributes.stream().filter(// 
            schemaAtt -> schemaAtt.getId().equals(passwordAttribute.getSchemaAttribute())).findFirst().orElse(null);
            ProvisioningAttributeDto passwordProvisiongAttributeDto = ProvisioningAttributeDto.createProvisioningAttributeKey(passwordAttribute, schemaAttribute.getName(), schemaAttribute.getClassType());
            fullAccountObject.put(passwordProvisiongAttributeDto, transformPassword);
            // Update previous account object (gui left side)
            Map<ProvisioningAttributeDto, Object> accountObject = provisioningOperation.getProvisioningContext().getAccountObject();
            // Is needed put password also into account object. Complete provisioning operation can be stored in
            // queue and while retry the provisioning operation is value get from confidential storage.
            // Confidential key is composed by account object.
            String confidentialStrorageKey = provisioningOperationService.createAccountObjectPropertyKey(passwordProvisiongAttributeDto.getKey(), 0);
            confidentialStorage.saveGuardedString(provisioningOperation, confidentialStrorageKey, transformPassword);
            accountObject.put(passwordProvisiongAttributeDto, new ConfidentialString(confidentialStrorageKey));
        }
        for (Entry<ProvisioningAttributeDto, Object> entry : fullAccountObject.entrySet()) {
            ProvisioningAttributeDto provisioningAttribute = entry.getKey();
            Optional<SysSchemaAttributeDto> schemaAttributeOptional = schemaAttributes.stream().filter(schemaAttribute -> {
                return provisioningAttribute.getSchemaAttributeName().equals(schemaAttribute.getName());
            }).findFirst();
            if (!schemaAttributeOptional.isPresent()) {
                throw new ProvisioningException(AccResultCode.PROVISIONING_SCHEMA_ATTRIBUTE_IS_FOUND, ImmutableMap.of("attribute", provisioningAttribute.getSchemaAttributeName()));
            }
            Object idmValue = fullAccountObject.get(provisioningAttribute);
            SysSchemaAttributeDto schemaAttribute = schemaAttributeOptional.get();
            if (provisioningAttribute.isSendOnlyIfNotNull()) {
                if (this.isValueEmpty(idmValue)) {
                    // is null
                    continue;
                }
            }
            if (AttributeMappingStrategyType.CREATE == provisioningAttribute.getStrategyType() || AttributeMappingStrategyType.WRITE_IF_NULL == provisioningAttribute.getStrategyType()) {
                boolean existSetAttribute = // 
                fullAccountObject.keySet().stream().anyMatch(provisioningAttributeKey -> {
                    // 
                    return provisioningAttributeKey.getSchemaAttributeName().equals(schemaAttribute.getName()) && AttributeMappingStrategyType.SET == provisioningAttributeKey.getStrategyType();
                });
                boolean existIfResourceNulltAttribute = // 
                fullAccountObject.keySet().stream().anyMatch(provisioningAttributeKey -> {
                    // 
                    return provisioningAttributeKey.getSchemaAttributeName().equals(schemaAttribute.getName()) && AttributeMappingStrategyType.WRITE_IF_NULL == provisioningAttributeKey.getStrategyType();
                });
                boolean existMergeAttribute = // 
                fullAccountObject.keySet().stream().anyMatch(provisioningAttributeKey -> {
                    // 
                    return provisioningAttributeKey.getSchemaAttributeName().equals(schemaAttribute.getName()) && AttributeMappingStrategyType.MERGE == provisioningAttributeKey.getStrategyType();
                });
                boolean existAuthMergeAttribute = // 
                fullAccountObject.keySet().stream().anyMatch(provisioningAttributeKey -> {
                    return provisioningAttributeKey.getSchemaAttributeName().equals(schemaAttribute.getName()) && AttributeMappingStrategyType.AUTHORITATIVE_MERGE == provisioningAttributeKey.getStrategyType();
                });
                if (AttributeMappingStrategyType.CREATE == provisioningAttribute.getStrategyType()) {
                    if (existIfResourceNulltAttribute || existSetAttribute || existAuthMergeAttribute || existMergeAttribute) {
                        // (this strategies has higher priority)
                        continue;
                    }
                }
                if (AttributeMappingStrategyType.WRITE_IF_NULL == provisioningAttribute.getStrategyType()) {
                    if (existSetAttribute || existAuthMergeAttribute || existMergeAttribute) {
                        // (this strategies has higher priority)
                        continue;
                    }
                }
            }
            IcAttribute createdAttribute = createAttribute(schemaAttribute, fullAccountObject.get(provisioningAttribute));
            if (createdAttribute != null) {
                connectorObject.getAttributes().add(createdAttribute);
            }
        }
        provisioningContext.setConnectorObject(connectorObject);
    }
    provisioningOperation.setOperationType(ProvisioningEventType.CREATE);
}
Also used : IdmPasswordPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto) DtoUtils(eu.bcvsolutions.idm.core.api.utils.DtoUtils) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) Enabled(eu.bcvsolutions.idm.core.security.api.domain.Enabled) Autowired(org.springframework.beans.factory.annotation.Autowired) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) SysSystemAttributeMapping_(eu.bcvsolutions.idm.acc.entity.SysSystemAttributeMapping_) ConfidentialString(eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString) SysSchemaAttribute(eu.bcvsolutions.idm.acc.entity.SysSchemaAttribute) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) Map(java.util.Map) ProvisioningConfiguration(eu.bcvsolutions.idm.acc.config.domain.ProvisioningConfiguration) SysProvisioningAttributeService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningAttributeService) AbstractEntityEventProcessor(eu.bcvsolutions.idm.core.api.event.AbstractEntityEventProcessor) ImmutableMap(com.google.common.collect.ImmutableMap) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) UniformPasswordManager(eu.bcvsolutions.idm.acc.service.api.UniformPasswordManager) SysProvisioningOperationService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningOperationService) Collection(java.util.Collection) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) Set(java.util.Set) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Serializable(java.io.Serializable) List(java.util.List) ConnectorManager(eu.bcvsolutions.idm.acc.service.api.ConnectorManager) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) CollectionUtils(org.springframework.util.CollectionUtils) Entry(java.util.Map.Entry) Optional(java.util.Optional) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AccResultCode(eu.bcvsolutions.idm.acc.domain.AccResultCode) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) ProvisioningEventType(eu.bcvsolutions.idm.acc.domain.ProvisioningEventType) SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) MessageFormat(java.text.MessageFormat) Strings(com.google.common.base.Strings) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) AbstractDto(eu.bcvsolutions.idm.core.api.dto.AbstractDto) ConfidentialStorage(eu.bcvsolutions.idm.core.api.service.ConfidentialStorage) Lists(com.google.common.collect.Lists) LookupService(eu.bcvsolutions.idm.core.api.service.LookupService) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) EventResult(eu.bcvsolutions.idm.core.api.event.EventResult) EntityEvent(eu.bcvsolutions.idm.core.api.event.EntityEvent) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) AccModuleDescriptor(eu.bcvsolutions.idm.acc.AccModuleDescriptor) Description(org.springframework.context.annotation.Description) SysProvisioningArchiveService(eu.bcvsolutions.idm.acc.service.api.SysProvisioningArchiveService) IdmPasswordPolicyType(eu.bcvsolutions.idm.core.api.domain.IdmPasswordPolicyType) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) Component(org.springframework.stereotype.Component) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) ProvisioningService(eu.bcvsolutions.idm.acc.service.api.ProvisioningService) BaseDto(eu.bcvsolutions.idm.core.api.dto.BaseDto) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) IdmPasswordPolicyService(eu.bcvsolutions.idm.core.api.service.IdmPasswordPolicyService) Assert(org.springframework.util.Assert) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) ConfidentialString(eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ConfidentialString(eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString) ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) ProvisioningException(eu.bcvsolutions.idm.acc.exception.ProvisioningException) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)

Example 34 with SysSchemaAttributeDto

use of eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto in project CzechIdMng by bcvsolutions.

the class SystemMappingIdentityAutoAttributesProcessor method process.

@Override
public EventResult<SysSystemMappingDto> process(EntityEvent<SysSystemMappingDto> event) {
    SysSystemMappingDto dto = event.getContent();
    UUID schemaId = dto.getObjectClass();
    if (schemaId == null) {
        return new DefaultEventResult<>(event, this);
    }
    List<SysSchemaAttributeDto> schemaAttributes = getSchemaAttributes(schemaId);
    // UID attribute
    SysSchemaAttributeDto primarySchemaAttribute = getSchemaAttributeByCatalogue(schemaAttributes, this.getPrimaryKeyCatalogue());
    if (primarySchemaAttribute != null) {
        createAttributeMappingBySchemaAttribute(dto, primarySchemaAttribute, IdmIdentity_.username.getName(), true);
    }
    // First name attribute
    SysSchemaAttributeDto schemaAttribute = getSchemaAttributeByCatalogue(schemaAttributes, this.getFirstNameCatalogue());
    if (schemaAttribute != null) {
        createAttributeMappingBySchemaAttribute(dto, schemaAttribute, IdmIdentity_.firstName.getName(), false);
    }
    // Last name attribute
    schemaAttribute = getSchemaAttributeByCatalogue(schemaAttributes, this.getLastNameCatalogue());
    if (schemaAttribute != null) {
        createAttributeMappingBySchemaAttribute(dto, schemaAttribute, IdmIdentity_.lastName.getName(), false);
    }
    // Email attribute
    schemaAttribute = getSchemaAttributeByCatalogue(schemaAttributes, this.getEmailCatalogue());
    if (schemaAttribute != null) {
        createAttributeMappingBySchemaAttribute(dto, schemaAttribute, IdmIdentity_.email.getName(), false);
    }
    // Title before attribute
    schemaAttribute = getSchemaAttributeByCatalogue(schemaAttributes, this.getTitleBeforeCatalogue());
    if (schemaAttribute != null) {
        createAttributeMappingBySchemaAttribute(dto, schemaAttribute, IdmIdentity_.titleBefore.getName(), false);
    }
    // Title after attribute
    schemaAttribute = getSchemaAttributeByCatalogue(schemaAttributes, this.getTitleAfterCatalogue());
    if (schemaAttribute != null) {
        createAttributeMappingBySchemaAttribute(dto, schemaAttribute, IdmIdentity_.titleAfter.getName(), false);
    }
    // Phone attribute
    schemaAttribute = getSchemaAttributeByCatalogue(schemaAttributes, this.getPhoneCatalogue());
    if (schemaAttribute != null) {
        createAttributeMappingBySchemaAttribute(dto, schemaAttribute, IdmIdentity_.phone.getName(), false);
    }
    // Password attribute
    createAttributeMappingForPassword(dto, schemaAttributes);
    return new DefaultEventResult<>(event, this);
}
Also used : SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) UUID(java.util.UUID)

Example 35 with SysSchemaAttributeDto

use of eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto in project CzechIdMng by bcvsolutions.

the class AdGroupConnectorTypeTest method createMemberSystem.

private SysSystemDto createMemberSystem() {
    ConnectorType connectorType = connectorManager.getConnectorType(MockAdUserConnectorType.NAME);
    ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
    SysSystemDto systemDto = createSystem(this.getHelper().createName(), connectorTypeDto);
    connectorTypeDto.getMetadata().put(MockAdUserConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
    String newUserContainerMock = this.getHelper().createName();
    connectorTypeDto.getMetadata().put(MockAdUserConnectorType.NEW_USER_CONTAINER_KEY, newUserContainerMock);
    String userContainerMock = this.getHelper().createName();
    connectorTypeDto.getMetadata().put(MockAdUserConnectorType.USER_SEARCH_CONTAINER_KEY, userContainerMock);
    String deletedUserContainerMock = this.getHelper().createName();
    connectorTypeDto.getMetadata().put(MockAdUserConnectorType.DELETE_USER_CONTAINER_KEY, deletedUserContainerMock);
    String domainMock = this.getHelper().createName();
    connectorTypeDto.getMetadata().put(MockAdUserConnectorType.DOMAIN_KEY, domainMock);
    connectorTypeDto.setWizardStepName(MockAdUserConnectorType.STEP_FOUR);
    // Generate mock schema.
    generateMockMemberSchema(systemDto);
    // Execute step four.
    connectorManager.execute(connectorTypeDto);
    // Check containers on the system's operationOptions.
    systemDto = systemService.get(systemDto.getId());
    IdmFormDefinitionDto operationOptionsFormDefinition = systemService.getOperationOptionsConnectorFormDefinition(systemDto);
    String newUserContainer = getValueFromConnectorInstance(MockAdUserConnectorType.NEW_USER_CONTAINER_KEY, systemDto, operationOptionsFormDefinition);
    assertEquals(newUserContainerMock, newUserContainer);
    String deletedUserContainer = getValueFromConnectorInstance(MockAdUserConnectorType.DELETE_USER_CONTAINER_KEY, systemDto, operationOptionsFormDefinition);
    // Protected mode is not active -> delete user container should be null.
    assertNull(deletedUserContainer);
    String searchUserContainer = getValueFromConnectorInstance(MockAdUserConnectorType.USER_SEARCH_CONTAINER_KEY, systemDto, operationOptionsFormDefinition);
    assertEquals(userContainerMock, searchUserContainer);
    String domain = getValueFromConnectorInstance(MockAdUserConnectorType.DOMAIN_KEY, systemDto, operationOptionsFormDefinition);
    assertEquals(domainMock, domain);
    // Check created schema attributes.
    SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
    schemaAttributeFilter.setSystemId(systemDto.getId());
    List<SysSchemaAttributeDto> attributes = schemaAttributeService.find(schemaAttributeFilter, null).getContent();
    assertTrue(attributes.stream().anyMatch(attribute -> IcAttributeInfo.NAME.equals(attribute.getName())));
    assertTrue(attributes.stream().anyMatch(attribute -> IcAttributeInfo.PASSWORD.equals(attribute.getName())));
    assertTrue(attributes.stream().anyMatch(attribute -> IcAttributeInfo.ENABLE.equals(attribute.getName())));
    assertTrue(attributes.stream().anyMatch(attribute -> MockAdUserConnectorType.LDAP_GROUPS_ATTRIBUTE.equals(attribute.getName())));
    assertTrue(attributes.stream().anyMatch(attribute -> MockAdUserConnectorType.SAM_ACCOUNT_NAME_ATTRIBUTE.equals(attribute.getName())));
    // Check created schema attributes.
    SysSystemAttributeMappingFilter attributeMappingFilter = new SysSystemAttributeMappingFilter();
    attributeMappingFilter.setSystemId(systemDto.getId());
    List<SysSystemAttributeMappingDto> attributeMappingDtos = attributeMappingService.find(attributeMappingFilter, null).getContent();
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> IcAttributeInfo.NAME.equals(attribute.getName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> IcAttributeInfo.PASSWORD.equals(attribute.getName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> IcAttributeInfo.ENABLE.equals(attribute.getName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> MockAdUserConnectorType.LDAP_GROUPS_ATTRIBUTE.equals(attribute.getName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> MockAdUserConnectorType.LDAP_GROUPS_ATTRIBUTE.equals(attribute.getName()) && AttributeMappingStrategyType.MERGE == attribute.getStrategyType()));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> MockAdUserConnectorType.SAM_ACCOUNT_NAME_ATTRIBUTE.equals(attribute.getName())));
    return systemDto;
}
Also used : AdGroupConnectorType(eu.bcvsolutions.idm.acc.connector.AdGroupConnectorType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) MsAdSyncMappingRoleAutoAttributesProcessor(eu.bcvsolutions.idm.acc.event.processor.MsAdSyncMappingRoleAutoAttributesProcessor) After(org.junit.After) SysSyncConfigService(eu.bcvsolutions.idm.acc.service.api.SysSyncConfigService) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) IdmEntityStateService(eu.bcvsolutions.idm.core.api.service.IdmEntityStateService) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) IdmRoleCatalogueService(eu.bcvsolutions.idm.core.api.service.IdmRoleCatalogueService) List(java.util.List) ConnectorManager(eu.bcvsolutions.idm.acc.service.api.ConnectorManager) Assert.assertFalse(org.junit.Assert.assertFalse) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) IcObjectClassInfo(eu.bcvsolutions.idm.ic.api.IcObjectClassInfo) Lists(com.google.common.collect.Lists) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) IcAttributeInfo(eu.bcvsolutions.idm.ic.api.IcAttributeInfo) Before(org.junit.Before) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) MockAdGroupConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdGroupConnectorType) Assert.assertNotNull(org.junit.Assert.assertNotNull) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) Assert.assertTrue(org.junit.Assert.assertTrue) SysSyncRoleConfig_(eu.bcvsolutions.idm.acc.entity.SysSyncRoleConfig_) Test(org.junit.Test) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSyncRoleConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto) Assert.assertNull(org.junit.Assert.assertNull) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) BaseDto(eu.bcvsolutions.idm.core.api.dto.BaseDto) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) Assert.assertEquals(org.junit.Assert.assertEquals) Transactional(org.springframework.transaction.annotation.Transactional) 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) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Aggregations

SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)168 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)119 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)96 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)89 SysSchemaAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)86 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)79 Test (org.junit.Test)73 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)52 UUID (java.util.UUID)40 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)39 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)36 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)35 SysRoleSystemAttributeDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto)34 AttributeMappingStrategyType (eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType)28 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)27 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)27 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)26 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)26 Serializable (java.io.Serializable)26 List (java.util.List)25