private List<GrantedAuthority> getGrantedAuthorities(User user) { List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(); for (UserProfile userProfile : user.getUserProfile()) { authorities.add(new SimpleGrantedAuthority("ROLE_" + userProfile.getType())); } return authorities; }