private Collection<String> convertToGroups(List<? extends GrantedAuthority> authorities) {
        List<String> groups = new ArrayList<String>();
        for (GrantedAuthority authority : authorities) {
            groups.add(authority.getAuthority());
        }
        return groups;
    }
private Collection < String > convertToGroups ( List < ? extends GrantedAuthority > authorities ) { List < String > groups = new ArrayList < String > ( ) ; for ( GrantedAuthority authority : authorities ) { groups . add ( authority . getAuthority ( ) ) ; } return groups ; }
Convert authorities to group names.