Search in sources :

Example 26 with MiniKdc

use of org.apache.hadoop.minikdc.MiniKdc in project hbase by apache.

the class CustomSaslAuthenticationProviderTestBase method startCluster.

protected static void startCluster(String rpcServerImpl) throws Exception {
    KEYTAB_FILE = new File(UTIL.getDataTestDir("keytab").toUri().getPath());
    final MiniKdc kdc = UTIL.setupMiniKdc(KEYTAB_FILE);
    // Adds our test impls instead of creating service loader entries which
    // might inadvertently get them loaded on a real cluster.
    CONF.setStrings(SaslClientAuthenticationProviders.EXTRA_PROVIDERS_KEY, InMemoryClientProvider.class.getName());
    CONF.setStrings(SaslServerAuthenticationProviders.EXTRA_PROVIDERS_KEY, InMemoryServerProvider.class.getName());
    CONF.set(SaslClientAuthenticationProviders.SELECTOR_KEY, InMemoryProviderSelector.class.getName());
    createBaseCluster(UTIL, KEYTAB_FILE, kdc);
    CONF.set(RpcServerFactory.CUSTOM_RPC_SERVER_IMPL_CONF_KEY, rpcServerImpl);
    CLUSTER = new LocalHBaseCluster(CONF, 1);
    CLUSTER.startup();
}
Also used : MiniKdc(org.apache.hadoop.minikdc.MiniKdc) LocalHBaseCluster(org.apache.hadoop.hbase.LocalHBaseCluster) File(java.io.File)

Example 27 with MiniKdc

use of org.apache.hadoop.minikdc.MiniKdc in project incubator-atlas by apache.

the class BaseSecurityTest method startKDC.

protected File startKDC() throws Exception {
    File target = Files.createTempDirectory("sectest").toFile();
    File kdcWorkDir = new File(target, "kdc");
    Properties kdcConf = MiniKdc.createConf();
    kdcConf.setProperty(MiniKdc.DEBUG, "true");
    kdc = new MiniKdc(kdcConf, kdcWorkDir);
    kdc.start();
    Assert.assertNotNull(kdc.getRealm());
    return kdcWorkDir;
}
Also used : MiniKdc(org.apache.hadoop.minikdc.MiniKdc) Properties(java.util.Properties) ApplicationProperties(org.apache.atlas.ApplicationProperties) File(java.io.File)

Example 28 with MiniKdc

use of org.apache.hadoop.minikdc.MiniKdc in project hadoop by apache.

the class TestRMWebappAuthentication method setUp.

@BeforeClass
public static void setUp() {
    try {
        testMiniKDC = new MiniKdc(MiniKdc.createConf(), testRootDir);
        setupKDC();
    } catch (Exception e) {
        assertTrue("Couldn't create MiniKDC", false);
    }
}
Also used : MiniKdc(org.apache.hadoop.minikdc.MiniKdc) IOException(java.io.IOException) BeforeClass(org.junit.BeforeClass)

Example 29 with MiniKdc

use of org.apache.hadoop.minikdc.MiniKdc in project hadoop by apache.

the class TestHttpServerWithSpengo method setUp.

@BeforeClass
public static void setUp() throws Exception {
    try {
        testMiniKDC = new MiniKdc(MiniKdc.createConf(), testRootDir);
        testMiniKDC.start();
        testMiniKDC.createPrincipal(httpSpnegoKeytabFile, HTTP_USER + "/localhost");
    } catch (Exception e) {
        assertTrue("Couldn't setup MiniKDC", false);
    }
    Writer w = new FileWriter(secretFile);
    w.write("secret");
    w.close();
}
Also used : FileWriter(java.io.FileWriter) MiniKdc(org.apache.hadoop.minikdc.MiniKdc) FileWriter(java.io.FileWriter) Writer(java.io.Writer) BeforeClass(org.junit.BeforeClass)

Example 30 with MiniKdc

use of org.apache.hadoop.minikdc.MiniKdc in project hadoop by apache.

the class TestKMS method setUpMiniKdc.

private static void setUpMiniKdc(Properties kdcConf) throws Exception {
    File kdcDir = getTestDir();
    kdc = new MiniKdc(kdcConf, kdcDir);
    kdc.start();
    keytab = new File(kdcDir, "keytab");
    List<String> principals = new ArrayList<String>();
    principals.add("HTTP/localhost");
    principals.add("client");
    principals.add("hdfs");
    principals.add("otheradmin");
    principals.add("client/host");
    principals.add("client1");
    for (KMSACLs.Type type : KMSACLs.Type.values()) {
        principals.add(type.toString());
    }
    principals.add("CREATE_MATERIAL");
    principals.add("ROLLOVER_MATERIAL");
    kdc.createPrincipal(keytab, principals.toArray(new String[principals.size()]));
}
Also used : MiniKdc(org.apache.hadoop.minikdc.MiniKdc) ArrayList(java.util.ArrayList) File(java.io.File)

Aggregations

MiniKdc (org.apache.hadoop.minikdc.MiniKdc)41 File (java.io.File)33 Properties (java.util.Properties)18 BeforeClass (org.junit.BeforeClass)15 Configuration (org.apache.hadoop.conf.Configuration)10 FileWriter (java.io.FileWriter)5 IOException (java.io.IOException)5 Before (org.junit.Before)5 BindException (java.net.BindException)4 Closeable (java.io.Closeable)3 Writer (java.io.Writer)3 HBaseTestingUtil (org.apache.hadoop.hbase.HBaseTestingUtil)3 AuthenticationTokenIdentifier (org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier)3 Text (org.apache.hadoop.io.Text)3 Job (org.apache.hadoop.mapreduce.Job)3 Credentials (org.apache.hadoop.security.Credentials)3 Token (org.apache.hadoop.security.token.Token)3 TokenIdentifier (org.apache.hadoop.security.token.TokenIdentifier)3 Test (org.junit.Test)3 ApplicationProperties (org.apache.atlas.ApplicationProperties)2