/**
* Create default users.
*/
public void createDefaultUsers() throws Exception {
UserManager userManager = getUserManager();
// create admin user
String adminName = userManager.getAdminName();
if (!userManager.doesExist(adminName)) {
LOG.info("Creating user : " + adminName);
BaseUser adminUser = new BaseUser();
adminUser.setName(adminName);
adminUser.setPassword(adminName);
adminUser.setEnabled(true);
adminUser.setAuthorities(ADMIN_AUTHORITIES);
adminUser.setHomeDirectory("./res/home");
adminUser.setMaxIdleTime(0);
userManager.save(adminUser);
}
// create anonymous user
if (!userManager.doesExist("anonymous")) {
LOG.info("Creating user : anonymous");
BaseUser anonUser = new BaseUser();
anonUser.setName("anonymous");
anonUser.setPassword("");
anonUser.setAuthorities(ANON_AUTHORITIES);
anonUser.setEnabled(true);
anonUser.setHomeDirectory("./res/home");
anonUser.setMaxIdleTime(300);
userManager.save(anonUser);
}
}