public void verifyState(HttpRequest request, @Nullable String csrfState, @Nullable String login) {
    if (!shouldRequestBeChecked(request)) {
      return;
    }

    String failureCause = checkCsrf(csrfState, request.getHeader(CSRF_HEADER));
    if (failureCause != null) {
      throw AuthenticationException.newBuilder()
        .setSource(Source.local(Method.JWT))
        .setLogin(login)
        .setMessage(failureCause)
        .build();
    }
  }
@Test
  public void verify_state() {
    mockRequestCsrf(CSRF_STATE);
    mockPostJavaWsRequest();

    underTest.verifyState(request, CSRF_STATE, LOGIN);
  }