org.apache.hadoop.http.HttpServer.hasAdministratorAccess()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(77)

本文整理了Java中org.apache.hadoop.http.HttpServer.hasAdministratorAccess()方法的一些代码示例,展示了HttpServer.hasAdministratorAccess()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpServer.hasAdministratorAccess()方法的具体详情如下:
包路径:org.apache.hadoop.http.HttpServer
类名称:HttpServer
方法名:hasAdministratorAccess

HttpServer.hasAdministratorAccess介绍

[英]Does the user sending the HttpServletRequest has the administrator ACLs? If it isn't the case, response will be modified to send an error to the user.
[中]发送HttpServletRequest的用户是否具有管理员ACL?如果不是这样,响应将被修改以向用户发送错误。

代码示例

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
 * Checks the user has privileges to access to instrumentation servlets.
 * <p/>
 * If <code>hadoop.security.instrumentation.requires.admin</code> is set to FALSE
 * (default value) it always returns TRUE.
 * <p/>
 * If <code>hadoop.security.instrumentation.requires.admin</code> is set to TRUE
 * it will check that if the current user is in the admin ACLS. If the user is
 * in the admin ACLs it returns TRUE, otherwise it returns FALSE.
 *
 * @param servletContext the servlet context.
 * @param request the servlet request.
 * @param response the servlet response.
 * @return TRUE/FALSE based on the logic decribed above.
 */
public static boolean isInstrumentationAccessAllowed(
 ServletContext servletContext, HttpServletRequest request,
 HttpServletResponse response) throws IOException {
 Configuration conf =
  (Configuration) servletContext.getAttribute(CONF_CONTEXT_ATTRIBUTE);
 boolean access = true;
 boolean adminAccess = conf.getBoolean(
  CommonConfigurationKeys.HADOOP_SECURITY_INSTRUMENTATION_REQUIRES_ADMIN,
  false);
 if (adminAccess) {
  access = hasAdministratorAccess(servletContext, request, response);
 }
 return access;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/**
 * Checks the user has privileges to access to instrumentation servlets.
 * <p/>
 * If <code>hadoop.security.instrumentation.requires.admin</code> is set to FALSE
 * (default value) it always returns TRUE.
 * <p/>
 * If <code>hadoop.security.instrumentation.requires.admin</code> is set to TRUE
 * it will check that if the current user is in the admin ACLS. If the user is
 * in the admin ACLs it returns TRUE, otherwise it returns FALSE.
 *
 * @param servletContext the servlet context.
 * @param request the servlet request.
 * @param response the servlet response.
 * @return TRUE/FALSE based on the logic decribed above.
 */
public static boolean isInstrumentationAccessAllowed(
 ServletContext servletContext, HttpServletRequest request,
 HttpServletResponse response) throws IOException {
 Configuration conf =
  (Configuration) servletContext.getAttribute(CONF_CONTEXT_ATTRIBUTE);
 boolean access = true;
 boolean adminAccess = conf.getBoolean(
  CommonConfigurationKeys.HADOOP_SECURITY_INSTRUMENTATION_REQUIRES_ADMIN,
  false);
 if (adminAccess) {
  access = hasAdministratorAccess(servletContext, request, response);
 }
 return access;
}

代码示例来源:origin: io.fabric8/fabric-hadoop

/**
 * Checks the user has privileges to access to instrumentation servlets.
 * <p/>
 * If <code>hadoop.security.instrumentation.requires.admin</code> is set to 
 * FALSE (default value) it returns always returns TRUE.
 * <p/>
 * If <code>hadoop.security.instrumentation.requires.admin</code> is set to 
 * TRUE it will check that if the current user is in the admin ACLS. If the 
 * user is in the admin ACLs it returns TRUE, otherwise it returns FALSE.
 *
 * @param servletContext the servlet context.
 * @param request the servlet request.
 * @param response the servlet response.
 * @return TRUE/FALSE based on the logic decribed above.
 */
public static boolean isInstrumentationAccessAllowed(
  ServletContext servletContext, HttpServletRequest request,
  HttpServletResponse response) throws IOException {
 Configuration conf = (Configuration) servletContext
   .getAttribute(CONF_CONTEXT_ATTRIBUTE);
 boolean access = true;
 boolean adminAccess = conf.getBoolean(
   CommonConfigurationKeys.HADOOP_SECURITY_INSTRUMENTATION_REQUIRES_ADMIN,
   false);
 if (adminAccess) {
  access = hasAdministratorAccess(servletContext, request, response);
 }
 return access;
}

代码示例来源:origin: io.hops/hadoop-common

/**
 * Checks the user has privileges to access to instrumentation servlets.
 * <p/>
 * If <code>hadoop.security.instrumentation.requires.admin</code> is set to FALSE
 * (default value) it always returns TRUE.
 * <p/>
 * If <code>hadoop.security.instrumentation.requires.admin</code> is set to TRUE
 * it will check that if the current user is in the admin ACLS. If the user is
 * in the admin ACLs it returns TRUE, otherwise it returns FALSE.
 *
 * @param servletContext the servlet context.
 * @param request the servlet request.
 * @param response the servlet response.
 * @return TRUE/FALSE based on the logic decribed above.
 */
public static boolean isInstrumentationAccessAllowed(
 ServletContext servletContext, HttpServletRequest request,
 HttpServletResponse response) throws IOException {
 Configuration conf =
  (Configuration) servletContext.getAttribute(CONF_CONTEXT_ATTRIBUTE);
 boolean access = true;
 boolean adminAccess = conf.getBoolean(
  CommonConfigurationKeys.HADOOP_SECURITY_INSTRUMENTATION_REQUIRES_ADMIN,
  false);
 if (adminAccess) {
  access = hasAdministratorAccess(servletContext, request, response);
 }
 return access;
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/**
 * Checks the user has privileges to access to instrumentation servlets.
 * <p/>
 * If <code>hadoop.security.instrumentation.requires.admin</code> is set to FALSE
 * (default value) it always returns TRUE.
 * <p/>
 * If <code>hadoop.security.instrumentation.requires.admin</code> is set to TRUE
 * it will check that if the current user is in the admin ACLS. If the user is
 * in the admin ACLs it returns TRUE, otherwise it returns FALSE.
 *
 * @param servletContext the servlet context.
 * @param request the servlet request.
 * @param response the servlet response.
 * @return TRUE/FALSE based on the logic decribed above.
 */
public static boolean isInstrumentationAccessAllowed(
 ServletContext servletContext, HttpServletRequest request,
 HttpServletResponse response) throws IOException {
 Configuration conf =
  (Configuration) servletContext.getAttribute(CONF_CONTEXT_ATTRIBUTE);
 boolean access = true;
 boolean adminAccess = conf.getBoolean(
  CommonConfigurationKeys.HADOOP_SECURITY_INSTRUMENTATION_REQUIRES_ADMIN,
  false);
 if (adminAccess) {
  access = hasAdministratorAccess(servletContext, request, response);
 }
 return access;
}

相关文章