public Optional<UserDto> authenticate(Credentials credentials, HttpRequest request, AuthenticationEvent.Method method) {
    if (isLdapAuthActivated) {
      return Optional.of(doAuthenticate(fixCase(credentials), request, method));
    }
    return Optional.empty();
  }
@Test
  public void does_not_user_downcase_login() {
    settings.setProperty("sonar.authenticator.downcase", false);

    mockLdapAuthentication("LoGiN");
    mockLdapUserDetailsRetrieval("LoGiN", LDAP_USER_DETAILS);

    underTest.authenticate(new Credentials("LoGiN", PASSWORD), request, BASIC);

    assertThat(userRegistrar.isAuthenticated()).isTrue();
    assertThat(userRegistrar.getAuthenticatorParameters().getUserIdentity().getProviderLogin()).isEqualTo("LoGiN");
    verify(authenticationEvent).loginSuccess(request, "LoGiN", Source.realm(BASIC, LDAP_SECURITY_REALM_NAME));
  }