Search in sources :

Example 1 with PasswordLifeTimeType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordLifeTimeType in project midpoint by Evolveum.

the class ValuePolicyProcessor method normalize.

/**
	 * add defined default values
	 */
private void normalize(ValuePolicyType pp) {
    if (null == pp) {
        throw new IllegalArgumentException("Password policy cannot be null");
    }
    if (null == pp.getStringPolicy()) {
        StringPolicyType sp = new StringPolicyType();
        pp.setStringPolicy(StringPolicyUtils.normalize(sp));
    } else {
        pp.setStringPolicy(StringPolicyUtils.normalize(pp.getStringPolicy()));
    }
    if (null == pp.getLifetime()) {
        PasswordLifeTimeType lt = new PasswordLifeTimeType();
        lt.setExpiration(-1);
        lt.setWarnBeforeExpiration(0);
        lt.setLockAfterExpiration(0);
        lt.setMinPasswordAge(0);
        lt.setPasswordHistoryLength(0);
    }
    return;
}
Also used : StringPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.StringPolicyType) PasswordLifeTimeType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordLifeTimeType)

Example 2 with PasswordLifeTimeType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordLifeTimeType in project midpoint by Evolveum.

the class SecurityHelper method setDeprecatedPasswordPolicyProperties.

private void setDeprecatedPasswordPolicyProperties(ValuePolicyType passwordPolicyType, PasswordCredentialsPolicyType passwd) {
    PasswordLifeTimeType lifetime = passwordPolicyType.getLifetime();
    if (lifetime != null) {
        Integer expiration = lifetime.getExpiration();
        if (expiration != null && expiration != 0 && passwd.getMaxAge() == null) {
            passwd.setMaxAge(daysToDuration(expiration));
        }
        Integer minPasswordAge = lifetime.getMinPasswordAge();
        if (minPasswordAge != null && minPasswordAge != 0 && passwd.getMinAge() == null) {
            passwd.setMinAge(daysToDuration(minPasswordAge));
        }
        Integer passwordHistoryLength = lifetime.getPasswordHistoryLength();
        if (passwordHistoryLength != null && passwd.getHistoryLength() == null) {
            passwd.setHistoryLength(passwordHistoryLength);
        }
    }
    String minOccurs = passwordPolicyType.getMinOccurs();
    if (minOccurs != null && passwd.getMinOccurs() == null) {
        passwd.setMinOccurs(minOccurs);
    }
}
Also used : PasswordLifeTimeType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordLifeTimeType)

Aggregations

PasswordLifeTimeType (com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordLifeTimeType)2 StringPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.StringPolicyType)1