private static Authentication generateAuthenticationToken(final Authentication authentication,
                                                              final List<SimpleGrantedAuthority> authorities) {
        val username = authentication.getPrincipal().toString();
        val credentials = authentication.getCredentials();
        return new UsernamePasswordAuthenticationToken(username, credentials, authorities);
    }
This is {@link EndpointLdapAuthenticationProvider}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/authorization/EndpointLdapAuthenticationProvider.java