use of eu.esdihumboldt.hale.server.security.util.impl.ExtendedUser in project hale by halestudio.
the class UserDetailsServiceImpl method createUserDetails.
// private boolean usingOpenID() {
// return System.getProperty(BaseWebApplication.SYSTEM_PROPERTY_LOGIN_PAGE, "false")
// .toLowerCase().equals("openid");
// }
/**
* Create user details for a given user.
*
* @param user the user
* @param newUser if the user is a newly created user
* @return the user details
*/
private UserDetails createUserDetails(User user, boolean newUser) {
Collection<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();
// every user has the user role
authorities.add(new SimpleGrantedAuthority(ROLE_USER));
if (configurationService != null) {
boolean admin = configurationService.getBoolean("user." + user.getLogin() + ".admin", false);
if (admin) {
authorities.add(new SimpleGrantedAuthority(ROLE_ADMIN));
}
}
ExtendedUser userDetails = new ExtendedUser(user.getLogin(), user.getPassword(), true, true, true, true, authorities);
userDetails.setNewUser(newUser);
return userDetails;
}
Aggregations