@Override
    protected List<SimpleGrantedAuthority> generateAuthorizationForLdapEntry(final Principal profile,
                                                                             final LdapEntry userEntry) {
        val attribute = userEntry.getAttribute(this.roleAttribute);
        return Optional.ofNullable(attribute)
            .map(LdapAttribute::getStringValues)
            .map(value -> value.stream()
                .map(entry -> entry.toUpperCase(Locale.ENGLISH))
                .map(role -> StringUtils.prependIfMissing(role, rolePrefix))
                .map(SimpleGrantedAuthority::new)
                .collect(Collectors.toList()))
            .stream()
            .flatMap(List::stream)
            .toList();
    }
Provides a simple generator implementation that obtains user roles from an LDAP search.
Searches are performed by this component for every user details lookup:

@author Jerome Leleu
@author Marvin S. Addison
@author Misagh Moayyed
@since 4.0.0
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/authorization/LdapUserAttributesToRolesAuthorizationGenerator.java