// Read in all of the confidential user attribute values
Properties confidentialAttributes = new Properties();
UserAttributes userAttributes = (UserAttributes) PropertyClassManager.getInstance().getPropertyClass(UserAttributes.NAME);
for (PropertyDefinition def : userAttributes.getDefinitions()) {
AttributeDefinition attrDef = (AttributeDefinition) def;
if (attrDef.getVisibility() == AttributeDefinition.USER_CONFIDENTIAL_ATTRIBUTE) {
confidentialAttributes.setProperty(def.getName(), attrDef.getPropertyClass()
.retrieveProperty(new UserAttributeKey(info.getUser(), def.getName())));
}
}
try {
// Change the password
udb.changePassword(user.getPrincipalName(), f.getOldPassword(), f.getNewPassword(), false);
PublicKeyStore publicKeyStore = PublicKeyStore.getInstance();
if ("automatic".equals(Property.getProperty(new SystemConfigKey("security.privateKeyMode")))) {
if (publicKeyStore.isPassphraseValid(user.getPrincipalName(), f.getOldPassword())) {
publicKeyStore.changePrivateKeyPassphrase(user.getPrincipalName(), f.getOldPassword(), f.getNewPassword());
publicKeyStore.removeCachedKeys(user.getPrincipalName());
publicKeyStore.verifyPrivateKey(user.getPrincipalName(), f.getNewPassword().toCharArray());
// Write back all of the confidential user attribute values
for (PropertyDefinition def : userAttributes.getDefinitions()) {
AttributeDefinition attrDef = (AttributeDefinition) def;
if (attrDef.getVisibility() == AttributeDefinition.USER_CONFIDENTIAL_ATTRIBUTE) {
Property.setProperty(new UserAttributeKey(info.getUser(), def.getName()), confidentialAttributes
.getProperty(def.getName()), info);
}
}
} else {