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