@Override
  public void doFilter(HttpRequest request, HttpResponse response, FilterChain chain) {
    IdentityProvider provider = resolveProviderOrHandleResponse(request, response, CALLBACK_PATH);
    if (provider != null) {
      handleProvider(request, response, provider);
    }
  }
@Test
  public void do_filter_with_context_no_log_if_provider_did_not_call_authenticate_on_context() {
    when(request.getContextPath()).thenReturn("/sonarqube");
    when(request.getRequestURI()).thenReturn("/sonarqube/oauth2/callback/" + OAUTH2_PROVIDER_KEY);
    FakeOAuth2IdentityProvider identityProvider = new FakeOAuth2IdentityProvider(OAUTH2_PROVIDER_KEY, true);
    identityProviderRepository.addIdentityProvider(identityProvider);

    underTest.doFilter(request, response, chain);

    assertCallbackCalled(identityProvider);
    verify(authenticationEvent).loginFailure(eq(request), authenticationExceptionCaptor.capture());
    AuthenticationException authenticationException = authenticationExceptionCaptor.getValue();
    assertThat(authenticationException).hasMessage("Plugin did not call authenticate");
    assertThat(authenticationException.getSource()).isEqualTo(Source.oauth2(identityProvider));
    assertThat(authenticationException.getLogin()).isNull();
    assertThat(authenticationException.getPublicMessage()).isNull();
  }