@GET
  @Path("ticket")
  @ZeppelinApi
  public Response ticket() {
    String principal = authenticationService.getPrincipal();
    Set<String> roles = authenticationService.getAssociatedRoles();
    // ticket set to anonymous for anonymous user. Simplify testing.
    TicketContainer.Entry ticketEntry;
    if ("anonymous".equals(principal)) {
      ticketEntry = TicketContainer.ANONYMOUS_ENTRY;
    } else {
      ticketEntry = TicketContainer.instance.getTicketEntry(principal, roles);
    }

    Map<String, String> data = new HashMap<>();
    data.put("principal", ticketEntry.getPrincipal());
    data.put("roles", GSON.toJson(ticketEntry.getRoles()));
    data.put("ticket", ticketEntry.getTicket());

    JsonResponse<Map<String, String>> response = new JsonResponse<>(Response.Status.OK, "", data);
    LOG.warn("{}", response);
    return response.build();
  }
@Test
  void testTicket() throws IOException {
    CloseableHttpResponse get = httpGet("/security/ticket", "admin", "password1");
    Map<String, Object> resp = gson.fromJson(EntityUtils.toString(get.getEntity(), StandardCharsets.UTF_8),
        new TypeToken<Map<String, Object>>(){}.getType());
    Map<String, String> body = (Map<String, String>) resp.get("body");
    assertThat("Paramater principal", body.get("principal"),
        CoreMatchers.equalTo("admin"));
    assertThat("Paramater ticket", body.get("ticket"),
        CoreMatchers.not("anonymous"));
    get.close();
  }