Search in sources :

Example 1 with PasswordCredentialsPolicyType

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

the class SecurityHelper method postProcessPasswordPolicy.

private SecurityPolicyType postProcessPasswordPolicy(ValuePolicyType passwordPolicyType) {
    SecurityPolicyType securityPolicyType = new SecurityPolicyType();
    CredentialsPolicyType creds = new CredentialsPolicyType();
    PasswordCredentialsPolicyType passwd = new PasswordCredentialsPolicyType();
    ObjectReferenceType passwordPolicyRef = new ObjectReferenceType();
    passwordPolicyRef.asReferenceValue().setObject(passwordPolicyType.asPrismObject());
    passwd.setValuePolicyRef(passwordPolicyRef);
    creds.setPassword(passwd);
    securityPolicyType.setCredentials(creds);
    setDeprecatedPasswordPolicyProperties(passwordPolicyType, passwd);
    return securityPolicyType;
}
Also used : PasswordCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordCredentialsPolicyType) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) SecurityPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType) CredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsPolicyType) PasswordCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordCredentialsPolicyType) NonceCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType) SecurityQuestionsCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType)

Example 2 with PasswordCredentialsPolicyType

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

the class SecurityHelper method postProcessSecurityPolicy.

private void postProcessSecurityPolicy(SecurityPolicyType securityPolicyType, Task task, OperationResult result) {
    CredentialsPolicyType creds = securityPolicyType.getCredentials();
    if (creds != null) {
        PasswordCredentialsPolicyType passwd = creds.getPassword();
        if (passwd != null) {
            postProcessPasswordCredentialPolicy(securityPolicyType, passwd, task, result);
        }
        for (NonceCredentialsPolicyType nonce : creds.getNonce()) {
            postProcessCredentialPolicy(securityPolicyType, nonce, "nonce credential policy", task, result);
        }
        SecurityQuestionsCredentialsPolicyType securityQuestions = creds.getSecurityQuestions();
        if (securityQuestions != null) {
            postProcessCredentialPolicy(securityPolicyType, securityQuestions, "security questions credential policy", task, result);
        }
    }
}
Also used : PasswordCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordCredentialsPolicyType) NonceCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType) SecurityQuestionsCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType) CredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsPolicyType) PasswordCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordCredentialsPolicyType) NonceCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType) SecurityQuestionsCredentialsPolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType)

Example 3 with PasswordCredentialsPolicyType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordCredentialsPolicyType 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)

Example 4 with PasswordCredentialsPolicyType

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

the class SecurityHelper method postProcessPasswordCredentialPolicy.

private void postProcessPasswordCredentialPolicy(SecurityPolicyType securityPolicyType, PasswordCredentialsPolicyType passwd, Task task, OperationResult result) {
    // Deprecated settings
    Integer passwordHistoryLength = passwd.getPasswordHistoryLength();
    if (passwordHistoryLength != null && passwd.getHistoryLength() == null) {
        passwd.setHistoryLength(passwordHistoryLength);
    }
    ObjectReferenceType passwordPolicyRef = passwd.getPasswordPolicyRef();
    if (passwordPolicyRef != null && passwd.getValuePolicyRef() == null) {
        passwd.setValuePolicyRef(passwordPolicyRef.clone());
    }
    ValuePolicyType valuePolicyType = postProcessCredentialPolicy(securityPolicyType, passwd, "password credential policy", task, result);
    if (valuePolicyType != null) {
        setDeprecatedPasswordPolicyProperties(valuePolicyType, passwd);
    }
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) ValuePolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ValuePolicyType)

Aggregations

CredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsPolicyType)2 NonceCredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType)2 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)2 PasswordCredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordCredentialsPolicyType)2 SecurityQuestionsCredentialsPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityQuestionsCredentialsPolicyType)2 PasswordLifeTimeType (com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordLifeTimeType)1 SecurityPolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType)1 ValuePolicyType (com.evolveum.midpoint.xml.ns._public.common.common_3.ValuePolicyType)1