当前位置: 首页>>代码示例>>Java>>正文


Java ServiceAuthorizationManager.refresh方法代码示例

本文整理汇总了Java中org.apache.hadoop.security.authorize.ServiceAuthorizationManager.refresh方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceAuthorizationManager.refresh方法的具体用法?Java ServiceAuthorizationManager.refresh怎么用?Java ServiceAuthorizationManager.refresh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.security.authorize.ServiceAuthorizationManager的用法示例。


在下文中一共展示了ServiceAuthorizationManager.refresh方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.apache.hadoop.security.authorize.ServiceAuthorizationManager; //导入方法依赖的package包/类
public static void init(Configuration conf, ServiceAuthorizationManager authManager) {
  // set service-level authorization security policy
  System.setProperty("hadoop.policy.file", "hbase-policy.xml");
  if (conf.getBoolean(ServiceAuthorizationManager.SERVICE_AUTHORIZATION_CONFIG, false)) {
    authManager.refresh(conf, new HBasePolicyProvider());
    ProxyUsers.refreshSuperUserGroupsConfiguration(conf);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:HBasePolicyProvider.java

示例2: init

import org.apache.hadoop.security.authorize.ServiceAuthorizationManager; //导入方法依赖的package包/类
public static void init(Configuration conf,
    ServiceAuthorizationManager authManager) {
  // set service-level authorization security policy
  System.setProperty("hadoop.policy.file", "hbase-policy.xml");
  if (conf.getBoolean(
        ServiceAuthorizationManager.SERVICE_AUTHORIZATION_CONFIG, false)) {
    authManager.refresh(conf, new HBasePolicyProvider());
  }
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:10,代码来源:HBasePolicyProvider.java

示例3: refreshServiceAcl

import org.apache.hadoop.security.authorize.ServiceAuthorizationManager; //导入方法依赖的package包/类
@Override
public void refreshServiceAcl() throws IOException {
  if (!conf.getBoolean(
          ServiceAuthorizationManager.SERVICE_AUTHORIZATION_CONFIG, false)) {
    throw new AuthorizationException("Service Level Authorization not enabled!");
  }
  ServiceAuthorizationManager.refresh(conf, new MapReducePolicyProvider());
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:9,代码来源:JobTracker.java

示例4: refreshServiceAcl

import org.apache.hadoop.security.authorize.ServiceAuthorizationManager; //导入方法依赖的package包/类
@Override
public void refreshServiceAcl() throws IOException {
  if (!serviceAuthEnabled) {
    throw new AuthorizationException("Service Level Authorization not enabled!");
  }

  ServiceAuthorizationManager.refresh(
    new Configuration(), new HDFSPolicyProvider());
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:10,代码来源:NameNode.java

示例5: doRPCs

import org.apache.hadoop.security.authorize.ServiceAuthorizationManager; //导入方法依赖的package包/类
private void doRPCs(Configuration conf, boolean expectFailure) throws Exception {
  ServiceAuthorizationManager.refresh(conf, new TestPolicyProvider());
  
  Server server = RPC.getServer(new TestImpl(), ADDRESS, 0, 5, true, conf);

  TestProtocol proxy = null;

  server.start();

  InetSocketAddress addr = NetUtils.getConnectAddress(server);
  RpcInstrumentation rpcMetrics = server.getRpcMetrics();
  
  try {
    proxy = (TestProtocol)RPC.getProxy(
        TestProtocol.class, TestProtocol.versionID, addr, conf);
    proxy.ping();

    if (expectFailure) {
      fail("Expect RPC.getProxy to fail with AuthorizationException!");
    }
  } catch (RemoteException e) {
    if (expectFailure) {
      assertTrue(e.unwrapRemoteException() instanceof AuthorizationException);
    } else {
      throw e;
    }
  } finally {
    server.stop();
    if (proxy != null) {
      RPC.stopProxy(proxy);
    }
    MetricsRecordBuilder rb = getMetrics(rpcMetrics);
    if (expectFailure) {
      assertCounter("rpcAuthorizationFailures", 1, rb);
    } else {
      assertCounter("rpcAuthorizationSuccesses", 1, rb);
    }
    //since we don't have authentication turned ON, we should see 
    // 0 for the authentication successes and 0 for failure
    assertCounter("rpcAuthenticationFailures", 0, rb);
    assertCounter("rpcAuthenticationSuccesses", 0, rb);
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:44,代码来源:TestRPC.java

示例6: initialize

import org.apache.hadoop.security.authorize.ServiceAuthorizationManager; //导入方法依赖的package包/类
/**
 * Initialize name-node.
 * 
 * @param conf the configuration
 */
private void initialize(Configuration conf) throws IOException {
  InetSocketAddress socAddr = NameNode.getAddress(conf);
  UserGroupInformation.setConfiguration(conf);
  SecurityUtil.login(conf, DFSConfigKeys.DFS_NAMENODE_KEYTAB_FILE_KEY, 
      DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY, socAddr.getHostName());
  int handlerCount = conf.getInt("dfs.namenode.handler.count", 10);
  
  // set service-level authorization security policy
  if (serviceAuthEnabled = 
        conf.getBoolean(
          ServiceAuthorizationManager.SERVICE_AUTHORIZATION_CONFIG, false)) {
    ServiceAuthorizationManager.refresh(conf, new HDFSPolicyProvider());
  }
  
  myMetrics = NameNodeInstrumentation.create(conf);
  this.namesystem = new FSNamesystem(this, conf);

  if (UserGroupInformation.isSecurityEnabled()) {
    namesystem.activateSecretManager();
  }

  // create rpc server
  InetSocketAddress dnSocketAddr = getServiceRpcServerAddress(conf);
  if (dnSocketAddr != null) {
    int serviceHandlerCount =
      conf.getInt(DFSConfigKeys.DFS_NAMENODE_SERVICE_HANDLER_COUNT_KEY,
                  DFSConfigKeys.DFS_NAMENODE_SERVICE_HANDLER_COUNT_DEFAULT);
    this.serviceRpcServer = RPC.getServer(this, dnSocketAddr.getHostName(), 
        dnSocketAddr.getPort(), serviceHandlerCount,
        false, conf, namesystem.getDelegationTokenSecretManager());
    this.serviceRPCAddress = this.serviceRpcServer.getListenerAddress();
    setRpcServiceServerAddress(conf);
  }
  this.server = RPC.getServer(this, socAddr.getHostName(),
      socAddr.getPort(), handlerCount, false, conf, namesystem
      .getDelegationTokenSecretManager());

  // The rpc-server port can be ephemeral... ensure we have the correct info
  this.serverAddress = this.server.getListenerAddress(); 
  FileSystem.setDefaultUri(conf, getUri(serverAddress));
  LOG.info("Namenode up at: " + this.serverAddress);

  

  startHttpServer(conf);
  this.server.start();  //start RPC server   
  if (serviceRpcServer != null) {
    serviceRpcServer.start();      
  }
  startTrashEmptier(conf);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:57,代码来源:NameNode.java


注:本文中的org.apache.hadoop.security.authorize.ServiceAuthorizationManager.refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。