try {
Weblogger roller = WebloggerFactory.getWeblogger();
UserManager umgr = roller.getUserManager();
userData = umgr.getUserByUserName(userDetails.getUsername(), Boolean.TRUE);
} catch (WebloggerException ex) {
throw new LdapDataAccessException("ERROR in user lookup", ex);
}
if (userData == null) {
throw new LdapDataAccessException("ERROR no user: " + userDetails.getUsername());
}
int roleCount = userData.getRoles().size();
if (defaultRole != null) roleCount++;
GrantedAuthority[] authorities = new GrantedAuthorityImpl[roleCount];