for (Iterator<Object> iter = props.keySet().iterator(); iter.hasNext();) {
String username = (String) iter.next();
configAttribEd.setAsText(props.getProperty(username));
UserAttribute attr = (UserAttribute) configAttribEd.getValue();
if (attr == null) continue;
// The master password policy is not yet available, the default is to
// have a minimum of 8 chars --> all passwords shorter than 8 chars
// are no candidates
if (attr.getPassword()==null || attr.getPassword().length() <8 )
continue;
// The default password is not allowed
if (defaultPasswordAsString.equals(attr.getPassword()))
continue;
// the user named "admin" having a non default password is the primary candiate
if (GeoServerUser.ADMIN_USERNAME.equals(username)) {
candidates.put(GeoServerUser.ADMIN_USERNAME,attr.getPassword());
continue;
}
// other users having the amin role are secondary candidates
if (attr.getAuthorities().contains(GeoServerRole.ADMIN_ROLE)) {
candidates.put(username,attr.getPassword());
}
}
}
String username = GeoServerUser.ADMIN_USERNAME;