user = getUserByUsername(username);
if (user==null)
throw new UsernameNotFoundException(userNotFoundMessage(username));
RoleCalculator calculator = new RoleCalculator(this,
getSecurityManager().getActiveRoleService());
user.setAuthorities(calculator.calculateRoles(user));
} catch (IOException e) {
throw new UsernameNotFoundException(userNotFoundMessage(username),e);
}
return user;
}