Search in sources :

Example 11 with AccUniformPasswordDto

use of eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto 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)

Example 12 with AccUniformPasswordDto

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

the class DefaultPasswordFilterManagerIntegrationTest method testUTF8CharactersUsername.

@Test
public void testUTF8CharactersUsername() {
    SysSystemDto system = createSystem(false);
    SysSystemDto systemTwo = createSystem(false);
    IdmIdentityDto identity = createIdentity(system);
    identity.setUsername("+ěščřžýáíé=)ů§.-ǒǐďǚǎǧȟǰǩľě😊⌛");
    identity = identityService.save(identity);
    String password = getHelper().createName();
    PasswordRequest request = prepareRequest(identity.getUsername(), system.getCode(), password);
    AccUniformPasswordDto uniformDefinition = createUniformDefinition(true);
    assignSystem(uniformDefinition, system, systemTwo);
    assignSystem(identity, systemTwo);
    setPasswordFilter(system, true);
    setPasswordFilter(systemTwo, true);
    checkEcho(identity, system, EchoCheck.DOESNT_EXIST);
    checkEcho(identity, systemTwo, EchoCheck.DOESNT_EXIST);
    processValidate(request, true);
    checkEcho(identity, system, EchoCheck.VALIDATE);
    checkEcho(identity, systemTwo, EchoCheck.VALIDATE);
    checkPassword(prepareUid(identity, system), password, false);
    processChange(request, true);
    checkEcho(identity, system, EchoCheck.VALIDATE_AND_CHANGE);
    checkEcho(identity, systemTwo, EchoCheck.VALIDATE_AND_CHANGE);
    // Password will not be same!
    checkPassword(prepareUid(identity, system), password, false);
    checkPassword(prepareUid(identity, systemTwo), password, true);
}
Also used : AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractPasswordFilterIntegrationTest(eu.bcvsolutions.idm.acc.AbstractPasswordFilterIntegrationTest)

Example 13 with AccUniformPasswordDto

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

the class DefaultPasswordFilterManagerIntegrationTest method testMoreSystemsUniformPasswordSystem.

@Test
public void testMoreSystemsUniformPasswordSystem() {
    SysSystemDto systemOne = createSystem(false);
    IdmIdentityDto identity = createIdentity(systemOne);
    setPasswordFilter(systemOne, true);
    List<SysSystemDto> systems = Lists.newArrayList(systemOne);
    AccUniformPasswordDto uniformPasswordDto = createUniformDefinition(false);
    assignSystem(uniformPasswordDto, systemOne);
    for (int index = 0; index < 11; index++) {
        SysSystemDto system = createSystem(false);
        assignSystem(identity, system);
        setPasswordFilter(system, true);
        assignSystem(uniformPasswordDto, system);
        systems.add(system);
    }
    String password = getHelper().createName();
    PasswordRequest request = prepareRequest(identity.getUsername(), systemOne.getCode(), password);
    systems.forEach(s -> {
        checkEcho(identity, s, EchoCheck.DOESNT_EXIST);
    });
    processValidate(request, true);
    systems.forEach(s -> {
        checkEcho(identity, s, EchoCheck.VALIDATE);
        checkPassword(prepareUid(identity, systemOne), password, false);
    });
    processChange(request, true);
    systems.forEach(s -> {
        checkEcho(identity, s, EchoCheck.VALIDATE_AND_CHANGE);
        if (!s.getId().equals(systemOne.getId())) {
            checkPassword(prepareUid(identity, systemOne), password, false);
        } else {
            checkPassword(prepareUid(identity, s), password, false);
        }
    });
}
Also used : AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractPasswordFilterIntegrationTest(eu.bcvsolutions.idm.acc.AbstractPasswordFilterIntegrationTest)

Example 14 with AccUniformPasswordDto

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

the class DefaultPasswordFilterManagerIntegrationTest method testUTF8CharactersPassword.

@Test
public void testUTF8CharactersPassword() {
    SysSystemDto system = createSystem(false);
    SysSystemDto systemTwo = createSystem(false);
    IdmIdentityDto identity = createIdentity(system);
    String password = "+ěščřžýáíé=)ů§.-ǒǐďǚǎǧȟǰǩľě😊⌛";
    PasswordRequest request = prepareRequest(identity.getUsername(), system.getCode(), password);
    AccUniformPasswordDto uniformDefinition = createUniformDefinition(true);
    assignSystem(uniformDefinition, system, systemTwo);
    assignSystem(identity, systemTwo);
    setPasswordFilter(system, true);
    setPasswordFilter(systemTwo, true);
    checkEcho(identity, system, EchoCheck.DOESNT_EXIST);
    checkEcho(identity, systemTwo, EchoCheck.DOESNT_EXIST);
    processValidate(request, true);
    checkEcho(identity, system, EchoCheck.VALIDATE);
    checkEcho(identity, systemTwo, EchoCheck.VALIDATE);
    checkPassword(prepareUid(identity, system), password, false);
    processChange(request, true);
    checkEcho(identity, system, EchoCheck.VALIDATE_AND_CHANGE);
    checkEcho(identity, systemTwo, EchoCheck.VALIDATE_AND_CHANGE);
    // Password will not be same!
    checkPassword(prepareUid(identity, system), password, false);
    checkPassword(prepareUid(identity, systemTwo), password, true);
}
Also used : AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractPasswordFilterIntegrationTest(eu.bcvsolutions.idm.acc.AbstractPasswordFilterIntegrationTest)

Example 15 with AccUniformPasswordDto

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

the class AbstractPasswordFilterIntegrationTest method createUniformDefinition.

protected AccUniformPasswordDto createUniformDefinition(boolean changeInIdm) {
    AccUniformPasswordDto dto = new AccUniformPasswordDto();
    dto.setCode(getHelper().createName());
    dto.setChangeInIdm(changeInIdm);
    return uniformPasswordService.save(dto);
}
Also used : AccUniformPasswordDto(eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto)

Aggregations

AccUniformPasswordDto (eu.bcvsolutions.idm.acc.dto.AccUniformPasswordDto)22 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)15 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)13 Test (org.junit.Test)12 AbstractPasswordFilterIntegrationTest (eu.bcvsolutions.idm.acc.AbstractPasswordFilterIntegrationTest)8 AccUniformPasswordSystemDto (eu.bcvsolutions.idm.acc.dto.AccUniformPasswordSystemDto)6 AccUniformPasswordFilter (eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordFilter)6 AccUniformPasswordSystemFilter (eu.bcvsolutions.idm.acc.dto.filter.AccUniformPasswordSystemFilter)6 UUID (java.util.UUID)6 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)5 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)4 AccAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccAccountFilter)4 Lists (com.google.common.collect.Lists)3 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)3 SysSyncContractConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto)3 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)3 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)3 AccAccount_ (eu.bcvsolutions.idm.acc.entity.AccAccount_)3 TestContractResource (eu.bcvsolutions.idm.acc.entity.TestContractResource)3 TestResource (eu.bcvsolutions.idm.acc.entity.TestResource)3