src/main/java/org/apache/hadoop/hdfs/server/namenode/analytics/web/NamenodeAnalyticsMethods.java
@GET
  @Path("/credentials")
  @Produces({MediaType.APPLICATION_JSON})
  public Response credentials() {
    final SecurityContext securityContext =
        (SecurityContext) context.getAttribute(NNA_SECURITY_CONTEXT);
    try {
      before();
      if (securityContext.isAuthenticationEnabled()) {
        return Response.ok(
                Helper.toJsonList(securityContext.getAccessLevels()), MediaType.APPLICATION_JSON)
            .build();
      } else {
        return Response.status(HttpStatus.SC_BAD_REQUEST).build();
      }
    } catch (Exception ex) {
      return handleException(ex);
    } finally {
      after();
    }
  }
/**
   * CREDENTIALS endpoint is meant to showcase what authorizations the querying user possesses in
   * JSON form.
   */
CREDENTIALS endpoint is meant to showcase what authorizations the querying user possesses in
JSON form.
CREDENTIALS endpoint is meant to showcase what authorizations the querying user possesses in JSON form .
@GET
  @Path("/credentials")
  @Produces({MediaType.APPLICATION_JSON})
  public Response credentials() {
    final SecurityContext securityContext =
        (SecurityContext) context.getAttribute(NNA_SECURITY_CONTEXT);
    try {
      before();
      if (securityContext.isAuthenticationEnabled()) {
        return Response.ok(
                Helper.toJsonList(securityContext.getAccessLevels()), MediaType.APPLICATION_JSON)
            .build();
      } else {
        return Response.status(HttpStatus.SC_BAD_REQUEST).build();
      }
    } catch (Exception ex) {
      return handleException(ex);
    } finally {
      after();
    }
  }
@ GET @ Path ( "/credentials" ) @ Produces ( { MediaType . APPLICATION_JSON } ) public Response credentials ( ) { final SecurityContext securityContext = ( SecurityContext ) context . getAttribute ( NNA_SECURITY_CONTEXT ) ; try { before ( ) ; if ( securityContext . isAuthenticationEnabled ( ) ) { return Response . ok ( Helper . toJsonList ( securityContext . getAccessLevels ( ) ) , MediaType . APPLICATION_JSON ) . build ( ) ; } else { return Response . status ( HttpStatus . SC_BAD_REQUEST ) . build ( ) ; } } catch ( Exception ex ) { return handleException ( ex ) ; } finally { after ( ) ; } }
CREDENTIALS endpoint is meant to showcase what authorizations the querying user possesses in
 JSON form.
CREDENTIALS endpoint is meant to showcase what authorizations the querying user possesses in JSON form .