@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 fail_on_not_oauth2_provider() throws Exception {
    String providerKey = "openid";
    when(request.getRequestURI()).thenReturn("/oauth2/callback/" + providerKey);
    identityProviderRepository.addIdentityProvider(new FakeBasicIdentityProvider(providerKey, true));

    underTest.doFilter(request, response, chain);

    assertError("Not an OAuth2IdentityProvider: class org.sonar.server.authentication.FakeBasicIdentityProvider");
    verifyNoInteractions(authenticationEvent);
  }