Search in sources :

Example 46 with TestResource

use of eu.bcvsolutions.idm.acc.entity.TestResource in project CzechIdMng by bcvsolutions.

the class IdentitySyncTest method setStateToDescriptionValue.

@Transactional
public void setStateToDescriptionValue(String username, String status) {
    // TestResource resourceUser = new TestResource();
    TestResource resourceUser = entityManager.find(TestResource.class, username);
    resourceUser.setDescrip(status);
// entityManager.persist(resourceUser);
// entityManager.merge(resourceUser);
}
Also used : TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) Transactional(org.springframework.transaction.annotation.Transactional)

Example 47 with TestResource

use of eu.bcvsolutions.idm.acc.entity.TestResource in project CzechIdMng by bcvsolutions.

the class DefaultUniformPasswordManagerIntegrationTest method testUniformPasswordInIdM.

@Test
public void testUniformPasswordInIdM() {
    try {
        // Turn on an async execution.
        getHelper().setConfigurationValue(EventConfiguration.PROPERTY_EVENT_ASYNCHRONOUS_ENABLED, true);
        getHelper().setConfigurationValue(SchedulerConfiguration.PROPERTY_TASK_ASYNCHRONOUS_ENABLED, true);
        SysSystemDto contractSystem = initData();
        Assert.assertNotNull(contractSystem);
        IdmTreeTypeDto treeType = helper.createTreeType();
        AbstractSysSyncConfigDto config = doCreateSyncConfig(contractSystem, treeType);
        Assert.assertTrue(config instanceof SysSyncContractConfigDto);
        SysSystemDto targetSystemOne = helper.createTestResourceSystem(true);
        // Create system two with account suffix "_targetSystemTwo".
        String targetSystemTwoSuffix = "_targetSystemTwo";
        SysSystemDto targetSystemTwo = helper.createTestResourceSystem(true);
        // Create uniform password definition.
        AccUniformPasswordDto uniformPasswordDef = createUniformPasswordDef(targetSystemOne, targetSystemTwo);
        // Enable change in the IdM.
        uniformPasswordDef.setChangeInIdm(true);
        uniformPasswordService.save(uniformPasswordDef);
        SysSystemMappingDto provisioningMapping = systemMappingService.findProvisioningMapping(targetSystemTwo.getId(), SystemEntityType.IDENTITY);
        List<SysSystemAttributeMappingDto> attributeMappingDtos = schemaAttributeMappingService.findBySystemMapping(provisioningMapping);
        SysSystemAttributeMappingDto uidAttribute = schemaAttributeMappingService.getUidAttribute(attributeMappingDtos, targetSystemTwo);
        uidAttribute.setTransformToResourceScript("return attributeValue + \"" + targetSystemTwoSuffix + "\"");
        schemaAttributeMappingService.save(uidAttribute);
        IdmRoleDto automaticRoleTreeOne = helper.createRole();
        helper.createRoleSystem(automaticRoleTreeOne, targetSystemOne);
        IdmTreeNodeDto treeNodeOne = helper.createTreeNode(treeType, null);
        helper.createAutomaticRole(automaticRoleTreeOne, treeNodeOne);
        IdmRoleDto automaticRoleTreeTwo = helper.createRole();
        helper.createRoleSystem(automaticRoleTreeTwo, targetSystemTwo);
        IdmTreeNodeDto treeNodeTwo = helper.createTreeNode(treeType, null);
        helper.createAutomaticRole(automaticRoleTreeTwo, treeNodeTwo);
        IdmIdentityDto ownerOne = helper.createIdentityOnly();
        List<TestContractResource> contractResources = Lists.newArrayList(this.createContract("1", ownerOne.getUsername(), null, "true", treeNodeOne.getCode(), null, null, null), this.createContract("2", ownerOne.getUsername(), null, "false", treeNodeTwo.getCode(), null, null, null));
        this.getBean().initContractData(contractResources);
        IdmIdentityContractFilter contractFilter = new IdmIdentityContractFilter();
        contractFilter.setIdentity(ownerOne.getId());
        contractService.find(contractFilter, null).getContent().forEach(contract -> contractService.delete(contract));
        Assert.assertEquals(0, contractService.find(contractFilter, null).getTotalElements());
        IdmIdentityFilter identityFilter = new IdmIdentityFilter();
        identityFilter.setAddPasswordMetadata(true);
        ownerOne = identityService.get(ownerOne.getId(), identityFilter);
        // Identities should be in the CREATED state.
        Assert.assertEquals(IdentityState.CREATED, ownerOne.getState());
        Assert.assertNull(ownerOne.getPassword());
        Assert.assertNull(ownerOne.getPasswordMetadata());
        SynchronizationSchedulableTaskExecutor lrt = new SynchronizationSchedulableTaskExecutor(config.getId());
        LongRunningFutureTask<Boolean> longRunningFutureTask = longRunningTaskManager.execute(lrt);
        UUID transactionIdLrt = longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).getTransactionId();
        // Waiting for the LRT will be running.
        getHelper().waitForResult(res -> {
            return !longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).isRunning();
        }, 50, 40);
        // Waiting for the LRT will be EXECUTED.
        getHelper().waitForResult(res -> {
            return longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).getResultState() != OperationState.EXECUTED;
        }, 250, 100);
        Assert.assertEquals(longRunningTaskService.get(longRunningFutureTask.getExecutor().getLongRunningTaskId()).getResultState(), OperationState.EXECUTED);
        SysSyncLogDto log = helper.checkSyncLog(config, SynchronizationActionType.CREATE_ENTITY, 2, OperationResultType.SUCCESS);
        Assert.assertFalse(log.isRunning());
        Assert.assertFalse(log.isContainsError());
        UUID transactionId = log.getTransactionId();
        Assert.assertNotNull(transactionId);
        Assert.assertEquals(transactionIdLrt, transactionId);
        contractFilter.setIdentity(ownerOne.getId());
        Assert.assertEquals(2, contractService.count(contractFilter));
        ownerOne = identityService.get(ownerOne.getId());
        // Identities should have a valid state.
        Assert.assertEquals(IdentityState.VALID, ownerOne.getState());
        // Waiting for removing entity state.
        IdmIdentityDto finalOwnerOne = ownerOne;
        getHelper().waitForResult(res -> {
            return uniformPasswordManager.getEntityState(finalOwnerOne.getId(), IdmIdentityDto.class, transactionId) != null;
        }, 50, 100);
        // LRT ended, entityStates must be removed.
        IdmEntityStateDto entityStateDtoOwnerOne = uniformPasswordManager.getEntityState(ownerOne.getId(), IdmIdentityDto.class, transactionId);
        Assert.assertNull(entityStateDtoOwnerOne);
        TestResource resourceOwnerOne = helper.findResource(ownerOne.getUsername());
        Assert.assertNotNull(resourceOwnerOne);
        TestResource resourceOwnerTwo = helper.findResource(ownerOne.getUsername() + targetSystemTwoSuffix);
        Assert.assertNotNull(resourceOwnerTwo);
        String passwordOwnerOne = resourceOwnerOne.getPassword();
        String passwordOwnerTwo = resourceOwnerTwo.getPassword();
        Assert.assertNotNull(passwordOwnerOne);
        Assert.assertNotNull(passwordOwnerTwo);
        Assert.assertEquals(passwordOwnerOne, passwordOwnerTwo);
        // Change in the IdM is enabled.
        ownerOne = identityService.get(ownerOne.getId(), identityFilter);
        Assert.assertNotNull(ownerOne.getPasswordMetadata());
        // One uniform password notification was send.
        IdmNotificationFilter notificationFilter = new IdmNotificationFilter();
        notificationFilter.setRecipient(ownerOne.getUsername());
        notificationFilter.setNotificationType(IdmEmailLog.class);
        notificationFilter.setTopic(CoreModule.TOPIC_UNIFORM_PASSWORD_SET);
        List<IdmNotificationLogDto> notificationLogDtos = notificationLogService.find(notificationFilter, null).getContent();
        Assert.assertEquals(1, notificationLogDtos.size());
        // None a new password notification was send.
        notificationFilter.setTopic(AccModuleDescriptor.TOPIC_NEW_PASSWORD);
        notificationLogDtos = notificationLogService.find(notificationFilter, null).getContent();
        Assert.assertEquals(0, notificationLogDtos.size());
        // None password set notification was send.
        notificationFilter.setTopic(CoreModule.TOPIC_PASSWORD_SET);
        notificationLogDtos = notificationLogService.find(notificationFilter, null).getContent();
        Assert.assertEquals(0, notificationLogDtos.size());
        // None password change notification was send.
        notificationFilter.setTopic(CoreModule.TOPIC_PASSWORD_CHANGED);
        notificationLogDtos = notificationLogService.find(notificationFilter, null).getContent();
        Assert.assertEquals(0, notificationLogDtos.size());
        // Delete log
        syncLogService.delete(log);
        // Delete identities.
        identityService.delete(ownerOne);
        // Delete uniform password def.
        uniformPasswordService.delete(uniformPasswordDef);
    } finally {
        // Turn off an async execution.
        getHelper().setConfigurationValue(EventConfiguration.PROPERTY_EVENT_ASYNCHRONOUS_ENABLED, false);
        getHelper().setConfigurationValue(SchedulerConfiguration.PROPERTY_TASK_ASYNCHRONOUS_ENABLED, false);
    }
}
Also used : IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) IdmIdentityFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityFilter) IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) TestContractResource(eu.bcvsolutions.idm.acc.entity.TestContractResource) SysSyncContractConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto) SynchronizationSchedulableTaskExecutor(eu.bcvsolutions.idm.acc.scheduler.task.impl.SynchronizationSchedulableTaskExecutor) IdmNotificationLogDto(eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationLogDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) UUID(java.util.UUID) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmNotificationFilter(eu.bcvsolutions.idm.core.notification.api.dto.filter.IdmNotificationFilter) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 48 with TestResource

use of eu.bcvsolutions.idm.acc.entity.TestResource in project CzechIdMng by bcvsolutions.

the class IdentitySyncTest method initIdentityData.

@Transactional
public void initIdentityData() {
    deleteAllResourceData();
    TestResource resourceUserOne = new TestResource();
    resourceUserOne.setName(IDENTITY_ONE);
    resourceUserOne.setFirstname(IDENTITY_ONE);
    resourceUserOne.setLastname(IDENTITY_ONE);
    resourceUserOne.setEavAttribute("1");
    entityManager.persist(resourceUserOne);
}
Also used : TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) Transactional(javax.transaction.Transactional)

Example 49 with TestResource

use of eu.bcvsolutions.idm.acc.entity.TestResource in project CzechIdMng by bcvsolutions.

the class IdentityPasswordProvisioningTest method testReadOnlySystem.

@Test
public void testReadOnlySystem() {
    String suffixForPassword = "-" + System.currentTimeMillis();
    SysSystemDto system = initSystem();
    system.setReadonly(true);
    system = systemService.save(system);
    SysSystemAttributeMappingDto descriptionAttribute = initDescriptionAttribute(system);
    descriptionAttribute = changeAttributeToPasswordMapping(descriptionAttribute, "" + "import eu.bcvsolutions.idm.core.security.api.domain.GuardedString;" + System.lineSeparator() + "" + System.lineSeparator() + "String newPassword = attributeValue.asString();" + System.lineSeparator() + "return new GuardedString(newPassword + '" + suffixForPassword + "');" + System.lineSeparator());
    IdmRoleDto role = initRole(system);
    IdmIdentityDto identity = helper.createIdentity();
    IdmIdentityRoleDto identityRole = helper.createIdentityRole(identity, role);
    checkIdentityAccount(identity, identityRole, 1);
    long deleteOperations = provisioningOperationService.deleteOperations(system.getId());
    assertEquals(1l, deleteOperations);
    // Execute provisioning
    identityService.save(identity);
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setEntityIdentifier(identity.getId());
    List<SysProvisioningOperationDto> operations = provisioningOperationService.find(filter, null).getContent();
    assertEquals(1, operations.size());
    SysProvisioningOperationDto operationDto = operations.get(0);
    assertEquals(ProvisioningEventType.CREATE, operationDto.getOperationType());
    Map<ProvisioningAttributeDto, Object> accountObject = operationDto.getProvisioningContext().getAccountObject();
    String confidentialAccountKeyPassword = null;
    String confidentialAccountKeyDescrip = null;
    String confidentialConnectorKeyPassword = null;
    String confidentialConnectorKeyDescrip = null;
    boolean descripAttributeExists = false;
    boolean passwordAttributeExists = false;
    for (Entry<ProvisioningAttributeDto, Object> entry : accountObject.entrySet()) {
        ProvisioningAttributeDto key = entry.getKey();
        if (key.getSchemaAttributeName().equalsIgnoreCase(TestHelper.ATTRIBUTE_MAPPING_DESCRIPTION)) {
            descripAttributeExists = true;
            Object value = entry.getValue();
            assertTrue(value instanceof ConfidentialString);
            ConfidentialString confidentialStorageValue = (ConfidentialString) value;
            confidentialAccountKeyDescrip = confidentialStorageValue.getKey();
            GuardedString guardedString = confidentialStorage.getGuardedString(operationDto, confidentialAccountKeyDescrip);
            assertNotNull(guardedString);
            String asString = guardedString.asString();
            assertEquals(DEFAULT_PASSWORD + suffixForPassword, asString);
        }
        if (key.getSchemaAttributeName().equalsIgnoreCase(ProvisioningService.PASSWORD_SCHEMA_PROPERTY_NAME)) {
            passwordAttributeExists = true;
            Object value = entry.getValue();
            assertTrue(value instanceof ConfidentialString);
            ConfidentialString confidentialStorageValue = (ConfidentialString) value;
            confidentialAccountKeyPassword = confidentialStorageValue.getKey();
            GuardedString guardedString = confidentialStorage.getGuardedString(operationDto, confidentialAccountKeyPassword);
            assertNotNull(guardedString);
            String asString = guardedString.asString();
            assertEquals(DEFAULT_PASSWORD, asString);
        }
    }
    assertTrue(passwordAttributeExists);
    assertTrue(descripAttributeExists);
    descripAttributeExists = false;
    passwordAttributeExists = false;
    IcConnectorObject connectorObject = operationDto.getProvisioningContext().getConnectorObject();
    for (IcAttribute attribute : connectorObject.getAttributes()) {
        if (attribute.getName().equalsIgnoreCase(TestHelper.ATTRIBUTE_MAPPING_DESCRIPTION)) {
            descripAttributeExists = true;
            Object value = attribute.getValue();
            assertTrue(value instanceof ConfidentialString);
            ConfidentialString confidentialStorageValue = (ConfidentialString) value;
            confidentialConnectorKeyDescrip = confidentialStorageValue.getKey();
            GuardedString guardedString = confidentialStorage.getGuardedString(operationDto, confidentialConnectorKeyDescrip);
            assertNotNull(guardedString);
            String asString = guardedString.asString();
            assertEquals(DEFAULT_PASSWORD + suffixForPassword, asString);
        }
        if (attribute.getName().equalsIgnoreCase(ProvisioningService.PASSWORD_SCHEMA_PROPERTY_NAME)) {
            passwordAttributeExists = true;
            Object value = attribute.getValue();
            assertTrue(value instanceof ConfidentialString);
            ConfidentialString confidentialStorageValue = (ConfidentialString) value;
            confidentialConnectorKeyPassword = confidentialStorageValue.getKey();
            GuardedString guardedString = confidentialStorage.getGuardedString(operationDto, confidentialConnectorKeyPassword);
            assertNotNull(guardedString);
            String asString = guardedString.asString();
            assertEquals(DEFAULT_PASSWORD, asString);
        }
    }
    assertTrue(passwordAttributeExists);
    assertTrue(descripAttributeExists);
    assertNotNull(confidentialAccountKeyPassword);
    assertNotNull(confidentialAccountKeyDescrip);
    assertNotNull(confidentialConnectorKeyPassword);
    assertNotNull(confidentialConnectorKeyDescrip);
    system.setReadonly(false);
    system = systemService.save(system);
    operationDto = provisioningExecutor.executeSync(operationDto);
    assertEquals(OperationState.EXECUTED, operationDto.getResultState());
    Serializable serializable = confidentialStorage.get(operationDto, confidentialAccountKeyPassword);
    assertNull(serializable);
    serializable = confidentialStorage.get(operationDto, confidentialAccountKeyDescrip);
    assertNull(serializable);
    serializable = confidentialStorage.get(operationDto, confidentialConnectorKeyPassword);
    assertNull(serializable);
    serializable = confidentialStorage.get(operationDto, confidentialConnectorKeyDescrip);
    assertNull(serializable);
    SysProvisioningOperationFilter archiveFilter = new SysProvisioningOperationFilter();
    archiveFilter.setSystemId(system.getId());
    archiveFilter.setEntityIdentifier(identity.getId());
    List<SysProvisioningArchiveDto> archive = provisioningArchiveService.find(archiveFilter, null).getContent();
    assertEquals(1, archive.size());
    SysProvisioningArchiveDto provisioningArchiveDto = archive.get(0);
    descripAttributeExists = false;
    passwordAttributeExists = false;
    for (Entry<ProvisioningAttributeDto, Object> entry : provisioningArchiveDto.getProvisioningContext().getAccountObject().entrySet()) {
        ProvisioningAttributeDto key = entry.getKey();
        if (key.getSchemaAttributeName().equalsIgnoreCase(TestHelper.ATTRIBUTE_MAPPING_DESCRIPTION)) {
            descripAttributeExists = true;
            Object value = entry.getValue();
            assertTrue(value instanceof ConfidentialString);
            ConfidentialString confidentialStorageValue = (ConfidentialString) value;
            confidentialAccountKeyDescrip = confidentialStorageValue.getKey();
            GuardedString guardedString = confidentialStorage.getGuardedString(operationDto, confidentialAccountKeyDescrip);
            assertNotNull(guardedString);
            assertTrue(StringUtils.isEmpty(guardedString.asString()));
            guardedString = confidentialStorage.getGuardedString(provisioningArchiveDto, confidentialAccountKeyDescrip);
            assertNotNull(guardedString);
            assertTrue(StringUtils.isEmpty(guardedString.asString()));
        }
        if (key.getSchemaAttributeName().equalsIgnoreCase(ProvisioningService.PASSWORD_SCHEMA_PROPERTY_NAME)) {
            passwordAttributeExists = true;
            Object value = entry.getValue();
            assertTrue(value instanceof ConfidentialString);
            ConfidentialString confidentialStorageValue = (ConfidentialString) value;
            confidentialAccountKeyPassword = confidentialStorageValue.getKey();
            GuardedString guardedString = confidentialStorage.getGuardedString(operationDto, confidentialAccountKeyPassword);
            assertNotNull(guardedString);
            assertTrue(StringUtils.isEmpty(guardedString.asString()));
            guardedString = confidentialStorage.getGuardedString(provisioningArchiveDto, confidentialAccountKeyPassword);
            assertNotNull(guardedString);
            assertTrue(StringUtils.isEmpty(guardedString.asString()));
        }
    }
    assertTrue(passwordAttributeExists);
    assertTrue(descripAttributeExists);
    descripAttributeExists = false;
    passwordAttributeExists = false;
    connectorObject = provisioningArchiveDto.getProvisioningContext().getConnectorObject();
    for (IcAttribute attribute : connectorObject.getAttributes()) {
        if (attribute.getName().equalsIgnoreCase(TestHelper.ATTRIBUTE_MAPPING_DESCRIPTION)) {
            descripAttributeExists = true;
            Object value = attribute.getValue();
            assertTrue(value instanceof ConfidentialString);
            ConfidentialString confidentialStorageValue = (ConfidentialString) value;
            confidentialConnectorKeyDescrip = confidentialStorageValue.getKey();
            GuardedString guardedString = confidentialStorage.getGuardedString(operationDto, confidentialConnectorKeyDescrip);
            assertNotNull(guardedString);
            assertTrue(StringUtils.isEmpty(guardedString.asString()));
            guardedString = confidentialStorage.getGuardedString(provisioningArchiveDto, confidentialConnectorKeyDescrip);
            assertNotNull(guardedString);
            assertTrue(StringUtils.isEmpty(guardedString.asString()));
        }
        if (attribute.getName().equalsIgnoreCase(ProvisioningService.PASSWORD_SCHEMA_PROPERTY_NAME)) {
            passwordAttributeExists = true;
            Object value = attribute.getValue();
            assertTrue(value instanceof ConfidentialString);
            ConfidentialString confidentialStorageValue = (ConfidentialString) value;
            confidentialConnectorKeyPassword = confidentialStorageValue.getKey();
            GuardedString guardedString = confidentialStorage.getGuardedString(operationDto, confidentialConnectorKeyPassword);
            assertNotNull(guardedString);
            assertTrue(StringUtils.isEmpty(guardedString.asString()));
            guardedString = confidentialStorage.getGuardedString(provisioningArchiveDto, confidentialConnectorKeyPassword);
            assertNotNull(guardedString);
            assertTrue(StringUtils.isEmpty(guardedString.asString()));
        }
    }
    List<AccAccountDto> accounts = accountService.getAccounts(system.getId(), identity.getId());
    assertEquals(1, accounts.size());
    AccAccountDto accountDto = accounts.get(0);
    TestResource resource = this.helper.findResource(accountDto.getUid());
    assertNotNull(resource);
    assertEquals(DEFAULT_PASSWORD, resource.getPassword());
    assertEquals(DEFAULT_PASSWORD + suffixForPassword, resource.getDescrip());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) Serializable(java.io.Serializable) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) ConfidentialString(eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ConfidentialString(eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 50 with TestResource

use of eu.bcvsolutions.idm.acc.entity.TestResource in project CzechIdMng by bcvsolutions.

the class IdentityPasswordProvisioningTest method testIdentityPasswordChange.

@Test
public void testIdentityPasswordChange() {
    SysSystemDto system = initSystem();
    IdmRoleDto role = initRole(system);
    String identityUsername = "test-" + System.currentTimeMillis();
    IdmIdentityDto identity = helper.createIdentity(identityUsername);
    IdmIdentityRoleDto identityRole = helper.createIdentityRole(identity, role);
    checkIdentityAccount(identity, identityRole, 1);
    String newPassword = "newPass" + System.currentTimeMillis();
    changePassword(identity, null, newPassword);
    TestResource findResource = helper.findResource(identityUsername);
    assertNotNull(findResource);
    assertEquals(newPassword, findResource.getPassword());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) ConfidentialString(eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) TestResource(eu.bcvsolutions.idm.acc.entity.TestResource) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

TestResource (eu.bcvsolutions.idm.acc.entity.TestResource)97 Test (org.junit.Test)83 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)81 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)69 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)51 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)50 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)36 AccIdentityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter)32 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)32 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)30 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)27 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)26 ConfidentialString (eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString)19 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)17 SysSchemaAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)12 PasswordChangeDto (eu.bcvsolutions.idm.core.api.dto.PasswordChangeDto)12 OperationResult (eu.bcvsolutions.idm.core.api.entity.OperationResult)12 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)11 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)10 Transactional (org.springframework.transaction.annotation.Transactional)10