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));
}
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;
}
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"));
}
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"));
}
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"));
}
Aggregations