String getJwtFromBearerAuthorization(HttpServletRequest req) {
    String authorizationHeader = req.getHeader(HttpHeader.AUTHORIZATION.asString());
    if (authorizationHeader == null || !authorizationHeader.startsWith(BEARER)) {
      return null;
    } else {
      return authorizationHeader.substring(BEARER.length()).trim();
    }
  }
@Test
  public void testParseTokenFromAuthHeader() {
    JwtAuthenticator authenticator = new JwtAuthenticator(TOKEN_PROVIDER, JWT_TOKEN);
    HttpServletRequest request = mock(HttpServletRequest.class);
    expect(request.getHeader(HttpHeader.AUTHORIZATION.asString())).andReturn(JwtAuthenticator.BEARER + " " + EXPECTED_TOKEN);
    replay(request);
    String actualToken = authenticator.getJwtFromBearerAuthorization(request);
    verify(request);
    assertEquals(EXPECTED_TOKEN, actualToken);
  }