List<String> values;
switch (policy.getType()) {
case PASSWORD:
case GLOBAL_PASSWORD:
final PasswordPolicySpec ppSpec = policy.getSpecification();
final PasswordPolicySpec evaluatedPPSpec = new PasswordPolicySpec();
BeanUtils.copyProperties(ppSpec, evaluatedPPSpec, new String[]{"schemasNotPermitted"});
for (String schema : ppSpec.getSchemasNotPermitted()) {
attribute = attributable.getAttribute(schema);
if (attribute != null) {
values = attribute.getValuesAsStrings();
if (values != null && !values.isEmpty()) {
evaluatedPPSpec.getWordsNotPermitted().add(values.get(0));
}
}
}
// Password history verification and update
if (!(attributable instanceof SyncopeUser)) {
LOG.error("Cannot check previous passwords. attributable is not a user object: {}",
attributable.getClass().getName());
result = (T) evaluatedPPSpec;
break;
}
SyncopeUser user = (SyncopeUser) attributable;
if (user.verifyPasswordHistory(user.getClearPassword(), ppSpec.getHistoryLength())) {
evaluatedPPSpec.getWordsNotPermitted().add(user.getClearPassword());
}
result = (T) evaluatedPPSpec;
break;
case ACCOUNT:
case GLOBAL_ACCOUNT: