Java Code Examples for org.apache.hadoop.security.authorize.Service

The following examples show how to use org.apache.hadoop.security.authorize.Service. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Bats   Source File: StreamingContainerParent.java    License: Apache License 2.0 5 votes vote down vote up
protected void startRpcServer()
{
  Configuration conf = getConfig();
  LOG.info("Config: " + conf);
  LOG.info("Listener thread count " + listenerThreadCount);
  try {
    server = new RPC.Builder(conf).setProtocol(StreamingContainerUmbilicalProtocol.class).setInstance(this)
        .setBindAddress("0.0.0.0").setPort(0).setNumHandlers(listenerThreadCount).setSecretManager(tokenSecretManager)
        .setVerbose(false).build();

    // Enable service authorization?
    if (conf.getBoolean(
        CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
        false)) {
      //refreshServiceAcls(conf, new MRAMPolicyProvider());
      server.refreshServiceAcl(conf, new PolicyProvider()
      {

        @Override
        public Service[] getServices()
        {
          return (new Service[]{
              new Service(StreamingContainerUmbilicalProtocol.class
                  .getName(), StreamingContainerUmbilicalProtocol.class)
          });
        }

      });
    }

    server.start();
    this.address = NetUtils.getConnectAddress(server);
    LOG.info("Container callback server listening at " + this.address);
  } catch (IOException e) {
    throw new YarnRuntimeException(e);
  }
}
 
Example 2
Source Project: hadoop   Source File: TimelinePolicyProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Service[] getServices() {
  return new Service[] {
      new Service(
          YarnConfiguration.YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONHISTORY_PROTOCOL,
          ApplicationHistoryProtocolPB.class)
  };
}
 
Example 3
Source Project: big-c   Source File: TimelinePolicyProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Service[] getServices() {
  return new Service[] {
      new Service(
          YarnConfiguration.YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONHISTORY_PROTOCOL,
          ApplicationHistoryProtocolPB.class)
  };
}
 
Example 4
Source Project: attic-apex-core   Source File: StreamingContainerParent.java    License: Apache License 2.0 5 votes vote down vote up
protected void startRpcServer()
{
  Configuration conf = getConfig();
  LOG.info("Config: " + conf);
  LOG.info("Listener thread count " + listenerThreadCount);
  try {
    server = new RPC.Builder(conf).setProtocol(StreamingContainerUmbilicalProtocol.class).setInstance(this)
        .setBindAddress("0.0.0.0").setPort(0).setNumHandlers(listenerThreadCount).setSecretManager(tokenSecretManager)
        .setVerbose(false).build();

    // Enable service authorization?
    if (conf.getBoolean(
        CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
        false)) {
      //refreshServiceAcls(conf, new MRAMPolicyProvider());
      server.refreshServiceAcl(conf, new PolicyProvider()
      {

        @Override
        public Service[] getServices()
        {
          return (new Service[]{
              new Service(StreamingContainerUmbilicalProtocol.class
                  .getName(), StreamingContainerUmbilicalProtocol.class)
          });
        }

      });
    }

    server.start();
    this.address = NetUtils.getConnectAddress(server);
    LOG.info("Container callback server listening at " + this.address);
  } catch (IOException e) {
    throw new YarnRuntimeException(e);
  }
}
 
Example 5
Source Project: hbase   Source File: TestTokenAuthentication.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  TEST_UTIL = new HBaseTestingUtility();
  // Override the connection registry to avoid spinning up a mini cluster for the connection below
  // to go through.
  TEST_UTIL.getConfiguration().set(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY,
      HConstants.ZK_CONNECTION_REGISTRY_CLASS);
  TEST_UTIL.startMiniZKCluster();
  // register token type for protocol
  SecurityInfo.addInfo(AuthenticationProtos.AuthenticationService.getDescriptor().getName(),
    new SecurityInfo("hbase.test.kerberos.principal",
      AuthenticationProtos.TokenIdentifier.Kind.HBASE_AUTH_TOKEN));
  // security settings only added after startup so that ZK does not require SASL
  Configuration conf = TEST_UTIL.getConfiguration();
  conf.set("hadoop.security.authentication", "kerberos");
  conf.set("hbase.security.authentication", "kerberos");
  conf.setBoolean(HADOOP_SECURITY_AUTHORIZATION, true);
  conf.set(RpcServerFactory.CUSTOM_RPC_SERVER_IMPL_CONF_KEY, rpcServerImpl);
  server = new TokenServer(conf, TEST_UTIL);
  serverThread = new Thread(server);
  Threads.setDaemonThreadRunning(serverThread, "TokenServer:"+server.getServerName().toString());
  // wait for startup
  while (!server.isStarted() && !server.isStopped()) {
    Thread.sleep(10);
  }
  server.rpcServer.refreshAuthManager(conf, new PolicyProvider() {
    @Override
    public Service[] getServices() {
      return new Service [] {
        new Service("security.client.protocol.acl",
          AuthenticationProtos.AuthenticationService.BlockingInterface.class)};
    }
  });
  ZKClusterId.setClusterId(server.getZooKeeper(), clusterId);
  secretManager = (AuthenticationTokenSecretManager)server.getSecretManager();
  while(secretManager.getCurrentKey() == null) {
    Thread.sleep(1);
  }
}
 
Example 6
Source Project: hadoop-ozone   Source File: SCMPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressFBWarnings("EI_EXPOSE_REP")
@Override
public Service[] getServices() {
  return SCM_SERVICES;
}
 
Example 7
Source Project: hadoop-ozone   Source File: ReconPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressFBWarnings("EI_EXPOSE_REP")
@Override
public Service[] getServices() {
  return RECON_SERVICES;
}
 
Example 8
Source Project: hadoop-ozone   Source File: OMPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressFBWarnings("EI_EXPOSE_REP")
@Override
public Service[] getServices() {
  return OM_SERVICES;
}
 
Example 9
Source Project: hadoop   Source File: NMPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return nodeManagerServices;
}
 
Example 10
Source Project: hadoop   Source File: RMPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return resourceManagerServices;
}
 
Example 11
Source Project: hadoop   Source File: ClientHSPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return mrHSServices;
}
 
Example 12
Source Project: hadoop   Source File: MRAMPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return mapReduceApplicationMasterServices;
}
 
Example 13
Source Project: hadoop   Source File: HDFSPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return hdfsServices;
}
 
Example 14
Source Project: hadoop   Source File: TestRPC.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return new Service[] { new Service(ACL_CONFIG, TestProtocol.class) };
}
 
Example 15
Source Project: big-c   Source File: NMPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return nodeManagerServices;
}
 
Example 16
Source Project: big-c   Source File: RMPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return resourceManagerServices;
}
 
Example 17
Source Project: big-c   Source File: ClientHSPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return mrHSServices;
}
 
Example 18
Source Project: big-c   Source File: MRAMPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return mapReduceApplicationMasterServices;
}
 
Example 19
Source Project: big-c   Source File: HDFSPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return hdfsServices;
}
 
Example 20
Source Project: big-c   Source File: TestRPC.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return new Service[] { new Service(ACL_CONFIG, TestProtocol.class) };
}
 
Example 21
Source Project: hbase   Source File: HBasePolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return services;
}
 
Example 22
Source Project: RDFS   Source File: MapReducePolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return mapReduceServices;
}
 
Example 23
Source Project: RDFS   Source File: TestRPC.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return new Service[] { new Service(ACL_CONFIG, TestProtocol.class) };
}
 
Example 24
Source Project: RDFS   Source File: HDFSPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return hdfsServices;
}
 
Example 25
Source Project: incubator-tez   Source File: TezAMPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return tezApplicationMasterServices;
}
 
Example 26
Source Project: tez   Source File: TezAMPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return tezApplicationMasterServices.clone();
}
 
Example 27
Source Project: hadoop-gpu   Source File: MapReducePolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return mapReduceServices;
}
 
Example 28
Source Project: hadoop-gpu   Source File: TestRPC.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return new Service[] { new Service(ACL_CONFIG, TestProtocol.class) };
}
 
Example 29
Source Project: hadoop-gpu   Source File: HDFSPolicyProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Service[] getServices() {
  return hdfsServices;
}