@Override public Collection<? extends GrantedAuthority> mapAuthorities(Collection<? extends GrantedAuthority> authorities) { final Set<GrantedAuthority> authoritiesToReturn = authorities.stream() .map(authority -> mapAuthority(authority)) .flatMap(Collection::stream) .filter(authority -> authority != null) .collect(Collectors.toSet()); return authoritiesToReturn; }
final LdapAuthorityMapper ldapAuthorityMapper = new LdapAuthorityMapper(ldapSecurityProperties.getRoleMappings()); ldapAuthorityMapper.setRolePrefix(rolePrefix); ldapConfigurer.authoritiesMapper(ldapAuthorityMapper);