Search in sources :

Example 46 with IdmPasswordPolicyDto

use of eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto in project CzechIdMng by bcvsolutions.

the class DefaultIdmPasswordPolicyIntegrationTest method testGeneratePasshrase.

@Test
public void testGeneratePasshrase() {
    IdmPasswordPolicyDto policy = new IdmPasswordPolicyDto();
    policy.setName("test_02");
    policy.setType(IdmPasswordPolicyType.GENERATE);
    policy.setGenerateType(IdmPasswordPolicyGenerateType.PASSPHRASE);
    policy.setPassphraseWords(5);
    for (int index = 0; index < ATTEMPTS; index++) {
        String password = passwordPolicyService.generatePassword(policy);
        assertEquals(5, password.split(" ").length);
    }
}
Also used : IdmPasswordPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 47 with IdmPasswordPolicyDto

use of eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto in project CzechIdMng by bcvsolutions.

the class PasswordPolicyDeleteProcessor method process.

@Override
public EventResult<IdmPasswordPolicyDto> process(EntityEvent<IdmPasswordPolicyDto> event) {
    IdmPasswordPolicyDto dto = event.getContent();
    // 
    passwordPolicyService.deleteInternal(dto);
    // 
    return new DefaultEventResult<>(event, this);
}
Also used : IdmPasswordPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto) DefaultEventResult(eu.bcvsolutions.idm.core.api.event.DefaultEventResult)

Example 48 with IdmPasswordPolicyDto

use of eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto in project CzechIdMng by bcvsolutions.

the class DefaultIdmPasswordPolicyService method getMaxPasswordAge.

@Override
public Integer getMaxPasswordAge(List<IdmPasswordPolicyDto> policyList) {
    Assert.notNull(policyList);
    // 
    if (policyList.isEmpty()) {
        return null;
    }
    // 
    Integer passwordAge = new Integer(Integer.MIN_VALUE);
    for (IdmPasswordPolicyDto idmPasswordPolicy : policyList) {
        if (idmPasswordPolicy.getMaxPasswordAge() != 0 && idmPasswordPolicy.getMaxPasswordAge() > passwordAge) {
            passwordAge = idmPasswordPolicy.getMaxPasswordAge();
        }
    }
    // 
    if (passwordAge.equals(Integer.MIN_VALUE)) {
        return null;
    }
    // 
    return passwordAge;
}
Also used : IdmPasswordPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto)

Example 49 with IdmPasswordPolicyDto

use of eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto in project CzechIdMng by bcvsolutions.

the class DefaultIdmPasswordPolicyService method preValidate.

public void preValidate(IdmPasswordValidationDto passwordValidationDto) {
    IdmPasswordPolicyDto defaultPolicy = this.getDefaultPasswordPolicy(IdmPasswordPolicyType.VALIDATE);
    if (defaultPolicy == null) {
        defaultPolicy = new IdmPasswordPolicyDto();
    }
    List<IdmPasswordPolicyDto> passwordPolicyList = new ArrayList<IdmPasswordPolicyDto>();
    passwordPolicyList.add(defaultPolicy);
    preValidate(passwordValidationDto, passwordPolicyList);
}
Also used : IdmPasswordPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto) ArrayList(java.util.ArrayList)

Aggregations

IdmPasswordPolicyDto (eu.bcvsolutions.idm.core.api.dto.IdmPasswordPolicyDto)49 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)33 Test (org.junit.Test)33 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)14 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)13 PasswordChangeDto (eu.bcvsolutions.idm.core.api.dto.PasswordChangeDto)13 ArrayList (java.util.ArrayList)11 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)9 IdmPasswordValidationDto (eu.bcvsolutions.idm.core.api.dto.IdmPasswordValidationDto)9 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)8 IdmPasswordDto (eu.bcvsolutions.idm.core.api.dto.IdmPasswordDto)7 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)6 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)6 HashMap (java.util.HashMap)4 Map (java.util.Map)3 AccModuleDescriptor (eu.bcvsolutions.idm.acc.AccModuleDescriptor)2 AccIdentityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter)2 SysSystemFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemFilter)2 ProvisioningEvent (eu.bcvsolutions.idm.acc.event.ProvisioningEvent)2 AccIdentityAccountRepository (eu.bcvsolutions.idm.acc.repository.AccIdentityAccountRepository)2