@Override
  public void loginFailure(HttpRequest request, AuthenticationException e) {
    checkRequest(request);
    requireNonNull(e, "AuthenticationException can't be null");
    if (!LOGGER.isDebugEnabled()) {
      return;
    }
    Source source = e.getSource();
    LOGGER.debug("login failure [cause|{}][method|{}][provider|{}|{}][IP|{}|{}][login|{}]",
      emptyIfNull(e.getMessage()),
      source.getMethod(), source.getProvider(), source.getProviderName(),
      request.getRemoteAddr(), getAllIps(request),
      preventLogFlood(emptyIfNull(e.getLogin())));
  }
@Test
  public void login_failure_fails_with_NPE_if_request_is_null() {
    logTester.setLevel(Level.INFO);

    AuthenticationException exception = newBuilder().setSource(Source.sso()).build();
    assertThatThrownBy(() -> underTest.loginFailure(null, exception))
      .isInstanceOf(NullPointerException.class)
      .hasMessage("request can't be null");
  }