@Test
public void testHttpLoggerHidesAuthHeader() throws Exception {

  RequestContext requestContext = mock(RequestContext.class);
  Request request = Request.forUri("/", "PUT")
      .withPayload(ByteString.encodeUtf8("hello"))
      .withHeader(HttpHeaders.AUTHORIZATION, "Bearer s3cr3tp455w0rd");
  when(requestContext.request()).thenReturn(request);
  String email = "foo@bar.net";
  when(authenticator.authenticate(any())).thenReturn(() -> Optional.of(idToken));
  when(idToken.getPayload()).thenReturn(idTokenPayload);
  when(idTokenPayload.getEmail()).thenReturn(email);
  awaitResponse(Middlewares.httpLogger(log, authenticator)
      .apply(mockInnerHandler(requestContext))
      .invoke(requestContext));
  verify(log).info("{}{} {} by {} with headers {} parameters {} and payload {}",
      "[AUDIT] ",
      request.method(),
      request.uri(),
      email,
      Map.of(HttpHeaders.AUTHORIZATION, "<hidden>"),
      Map.of(),
      request.payload().orElseThrow().utf8());
}