Search in sources :

Example 1 with KerberosUserNameMapper

use of org.apache.ignite.hadoop.util.KerberosUserNameMapper in project ignite by apache.

the class ChainedUserNameMapperSelfTest method testChaining.

/**
     * Test actual chaining logic.
     *
     * @throws Exception If failed.
     */
public void testChaining() throws Exception {
    BasicUserNameMapper mapper1 = new BasicUserNameMapper();
    mapper1.setMappings(Collections.singletonMap("1", "101"));
    KerberosUserNameMapper mapper2 = new KerberosUserNameMapper();
    mapper2.setInstance(INSTANCE);
    mapper2.setRealm(REALM);
    ChainedUserNameMapper mapper = create(mapper1, mapper2);
    assertEquals("101" + "/" + INSTANCE + "@" + REALM, mapper.map("1"));
    assertEquals("2" + "/" + INSTANCE + "@" + REALM, mapper.map("2"));
    assertEquals(IgfsUtils.fixUserName(null) + "/" + INSTANCE + "@" + REALM, mapper.map(null));
}
Also used : KerberosUserNameMapper(org.apache.ignite.hadoop.util.KerberosUserNameMapper) BasicUserNameMapper(org.apache.ignite.hadoop.util.BasicUserNameMapper) ChainedUserNameMapper(org.apache.ignite.hadoop.util.ChainedUserNameMapper)

Example 2 with KerberosUserNameMapper

use of org.apache.ignite.hadoop.util.KerberosUserNameMapper in project ignite by apache.

the class Hadoop1DualAbstractTest method createSecondaryFileSystemStack.

/**
     * Creates secondary filesystems.
     * @return IgfsSecondaryFileSystem
     * @throws Exception On failure.
     */
@Override
protected IgfsSecondaryFileSystem createSecondaryFileSystemStack() throws Exception {
    startUnderlying();
    prepareConfiguration();
    KerberosUserNameMapper mapper1 = new KerberosUserNameMapper();
    mapper1.setRealm("TEST.COM");
    TestUserNameMapper mapper2 = new TestUserNameMapper();
    ChainedUserNameMapper mapper = new ChainedUserNameMapper();
    mapper.setMappers(mapper1, mapper2);
    CachingHadoopFileSystemFactory factory = new CachingHadoopFileSystemFactory();
    factory.setUri(secondaryUri);
    factory.setConfigPaths(secondaryConfFullPath);
    factory.setUserNameMapper(mapper);
    IgniteHadoopIgfsSecondaryFileSystem second = new IgniteHadoopIgfsSecondaryFileSystem();
    second.setFileSystemFactory(factory);
    igfsSecondary = new HadoopIgfsSecondaryFileSystemTestAdapter(factory);
    return second;
}
Also used : KerberosUserNameMapper(org.apache.ignite.hadoop.util.KerberosUserNameMapper) CachingHadoopFileSystemFactory(org.apache.ignite.hadoop.fs.CachingHadoopFileSystemFactory) IgniteHadoopIgfsSecondaryFileSystem(org.apache.ignite.hadoop.fs.IgniteHadoopIgfsSecondaryFileSystem) ChainedUserNameMapper(org.apache.ignite.hadoop.util.ChainedUserNameMapper)

Example 3 with KerberosUserNameMapper

use of org.apache.ignite.hadoop.util.KerberosUserNameMapper in project ignite by apache.

the class KerberosUserNameMapperSelfTest method testMapperInstanceAndRealm.

/**
     * Test mapper with instance and realm components.
     *
     * @throws Exception If failed.
     */
public void testMapperInstanceAndRealm() throws Exception {
    KerberosUserNameMapper mapper = create(INSTANCE, REALM);
    assertEquals(IgfsUtils.fixUserName(null) + "/" + INSTANCE + "@" + REALM, mapper.map(null));
    assertEquals("test" + "/" + INSTANCE + "@" + REALM, mapper.map("test"));
}
Also used : KerberosUserNameMapper(org.apache.ignite.hadoop.util.KerberosUserNameMapper)

Example 4 with KerberosUserNameMapper

use of org.apache.ignite.hadoop.util.KerberosUserNameMapper in project ignite by apache.

the class KerberosUserNameMapperSelfTest method testMapper.

/**
     * Test mapper without instance and realm components.
     *
     * @throws Exception If failed.
     */
public void testMapper() throws Exception {
    KerberosUserNameMapper mapper = create(null, null);
    assertEquals(IgfsUtils.fixUserName(null), mapper.map(null));
    assertEquals("test", mapper.map("test"));
}
Also used : KerberosUserNameMapper(org.apache.ignite.hadoop.util.KerberosUserNameMapper)

Example 5 with KerberosUserNameMapper

use of org.apache.ignite.hadoop.util.KerberosUserNameMapper in project ignite by apache.

the class KerberosUserNameMapperSelfTest method testMapperRealm.

/**
     * Test mapper with realm.
     *
     * @throws Exception If failed.
     */
public void testMapperRealm() throws Exception {
    KerberosUserNameMapper mapper = create(null, REALM);
    assertEquals(IgfsUtils.fixUserName(null) + "@" + REALM, mapper.map(null));
    assertEquals("test" + "@" + REALM, mapper.map("test"));
}
Also used : KerberosUserNameMapper(org.apache.ignite.hadoop.util.KerberosUserNameMapper)

Aggregations

KerberosUserNameMapper (org.apache.ignite.hadoop.util.KerberosUserNameMapper)7 ChainedUserNameMapper (org.apache.ignite.hadoop.util.ChainedUserNameMapper)2 CachingHadoopFileSystemFactory (org.apache.ignite.hadoop.fs.CachingHadoopFileSystemFactory)1 IgniteHadoopIgfsSecondaryFileSystem (org.apache.ignite.hadoop.fs.IgniteHadoopIgfsSecondaryFileSystem)1 BasicUserNameMapper (org.apache.ignite.hadoop.util.BasicUserNameMapper)1