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