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);
}
}
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);
}
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;
}
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);
}
Aggregations