Search in sources :

Example 1 with AccUniformPasswordFilter

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

the class DefaultPasswordFilterManager method getActiveUniformPasswordDefinitions.

/**
 * Get active uniform password definition for given system. System can be now only in
 * one password definition.
 * TODO: this behavior can be changed in future.
 *
 * @param systemDto
 * @return
 * @throws ResultCodeException when definition not found or uniform password definition is disabled
 */
private List<AccUniformPasswordDto> getActiveUniformPasswordDefinitions(SysSystemDto systemDto) {
    AccUniformPasswordFilter filter = new AccUniformPasswordFilter();
    filter.setSystemId(systemDto.getId());
    filter.setDisabled(Boolean.FALSE);
    List<AccUniformPasswordDto> definitions = uniformPasswordService.find(filter, null).getContent();
    if (definitions.isEmpty()) {
        return Lists.newArrayList();
    }
    return definitions;
}
Also used : AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) AccUniformPasswordFilter(eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordFilter)

Example 2 with AccUniformPasswordFilter

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

the class DefaultUniformPasswordManager method getUniformPasswordBySystem.

@Override
public AccUniformPasswordDto getUniformPasswordBySystem(UUID systemId) {
    Assert.notNull(systemId, "System ID cannot be null!");
    AccUniformPasswordFilter uniformPasswordFilter = new AccUniformPasswordFilter();
    uniformPasswordFilter.setSystemId(systemId);
    uniformPasswordFilter.setDisabled(Boolean.FALSE);
    return uniformPasswordService.find(uniformPasswordFilter, null).getContent().stream().findFirst().orElse(null);
}
Also used : AccUniformPasswordFilter(eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordFilter)

Example 3 with AccUniformPasswordFilter

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

the class DefaultAccTestHelper method cleaner.

/**
 * Manual delete of all automatic roles, sync, mappings. Because previous tests didn't make a delete well.
 */
@Override
public void cleaner() {
    // Delete all automatic roles.
    roleTreeNodeService.deleteAll(roleTreeNodeService.find(new IdmRoleTreeNodeFilter(), null).getContent());
    automaticRoleAttributeService.deleteAll(automaticRoleAttributeService.find(new IdmRoleTreeNodeFilter(), null).getContent());
    // Delete all syncs.
    syncConfigService.deleteAll(syncConfigService.find(new SysSyncConfigFilter(), null).getContent());
    // Delete all groups.
    systemGroupService.deleteAll(systemGroupService.find(new SysSystemGroupFilter(), null));
    // Delete all mappings.
    systemMappingService.deleteAll(systemMappingService.find(new SysSystemMappingFilter(), null).getContent());
    // Delete all uniform password definitions.
    uniformPasswordService.deleteAll(uniformPasswordService.find(new AccUniformPasswordFilter(), null).getContent());
}
Also used : IdmRoleTreeNodeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleTreeNodeFilter) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemGroupFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemGroupFilter) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) AccUniformPasswordFilter(eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordFilter)

Example 4 with AccUniformPasswordFilter

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

the class DefaultAccUniformPasswordServiceTest method testFilterSystemId.

@Test
public void testFilterSystemId() {
    SysSystemDto system = createSystem(true);
    SysSystemDto systemTwo = createSystem(true);
    AccUniformPasswordDto uniformDefinition = createUniformDefinition(true);
    assignSystem(uniformDefinition, system, systemTwo);
    AccUniformPasswordDto uniformDefinitionTwo = createUniformDefinition(true);
    assignSystem(uniformDefinitionTwo, systemTwo);
    AccUniformPasswordFilter filter = new AccUniformPasswordFilter();
    filter.setSystemId(system.getId());
    List<AccUniformPasswordDto> uniform = uniformPasswordService.find(filter, null).getContent();
    assertEquals(1, uniform.size());
    AccUniformPasswordDto uniformPasswordDto = uniform.get(0);
    assertEquals(uniformDefinition.getId(), uniformPasswordDto.getId());
}
Also used : AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AccUniformPasswordFilter(eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordFilter) Test(org.junit.Test) AbstractPasswordFilterIntegrationTest(eu.bcvsolutions.idm.acc.AbstractPasswordFilterIntegrationTest)

Example 5 with AccUniformPasswordFilter

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

the class DefaultAccUniformPasswordServiceTest method testFilterByCode.

@Test
public void testFilterByCode() {
    createUniformDefinition(true);
    AccUniformPasswordDto uniformDefinitionTwo = createUniformDefinition(true);
    createUniformDefinition(true);
    AccUniformPasswordFilter filter = new AccUniformPasswordFilter();
    filter.setCodeableIdentifier(uniformDefinitionTwo.getCode());
    List<AccUniformPasswordDto> uniform = uniformPasswordService.find(filter, null).getContent();
    assertEquals(1, uniform.size());
    AccUniformPasswordDto uniformPasswordDto = uniform.get(0);
    assertEquals(uniformDefinitionTwo.getId(), uniformPasswordDto.getId());
}
Also used : AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) AccUniformPasswordFilter(eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordFilter) Test(org.junit.Test) AbstractPasswordFilterIntegrationTest(eu.bcvsolutions.idm.acc.AbstractPasswordFilterIntegrationTest)

Aggregations

AccUniformPasswordFilter (eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordFilter)7 AccUniformPasswordDto (eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto)3 AbstractPasswordFilterIntegrationTest (eu.bcvsolutions.idm.acc.AbstractPasswordFilterIntegrationTest)2 Test (org.junit.Test)2 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)1 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)1 SysSystemGroupFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemGroupFilter)1 SysSystemMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)1 IdmRoleTreeNodeFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleTreeNodeFilter)1