use of org.apache.commons.configuration.PropertiesConfiguration in project incubator-atlas by apache.
the class LoginProcessorIT method testKerberosLogin.
@Test
public void testKerberosLogin() throws Exception {
final File keytab = setupKDCAndPrincipals();
LoginProcessor processor = new LoginProcessor() {
@Override
protected org.apache.commons.configuration.Configuration getApplicationConfiguration() {
PropertiesConfiguration config = new PropertiesConfiguration();
config.setProperty("atlas.authentication.method", "kerberos");
config.setProperty("atlas.authentication.principal", "dgi@EXAMPLE.COM");
config.setProperty("atlas.authentication.keytab", keytab.getAbsolutePath());
return config;
}
@Override
protected Configuration getHadoopConfiguration() {
Configuration config = new Configuration(false);
config.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, "kerberos");
config.setBoolean(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, true);
config.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTH_TO_LOCAL, kerberosRule);
return config;
}
@Override
protected boolean isHadoopCluster() {
return true;
}
};
processor.login();
Assert.assertTrue(UserGroupInformation.getLoginUser().getShortUserName().endsWith("dgi"));
Assert.assertNotNull(UserGroupInformation.getCurrentUser());
Assert.assertTrue(UserGroupInformation.isLoginKeytabBased());
Assert.assertTrue(UserGroupInformation.isSecurityEnabled());
kdc.stop();
}
use of org.apache.commons.configuration.PropertiesConfiguration in project incubator-atlas by apache.
the class FileAuthenticationTest method setUpAltasApplicationProperties.
private void setUpAltasApplicationProperties(String persistDir) throws Exception {
final PropertiesConfiguration configuration = new PropertiesConfiguration();
configuration.setProperty("atlas.authentication.method.file", "true");
configuration.setProperty("atlas.authentication.method.file.filename", persistDir + "/users-credentials");
configuration.setProperty("atlas.auth.policy.file", persistDir + "/policy-store.txt");
TestUtils.writeConfiguration(configuration, persistDir + File.separator + ApplicationProperties.APPLICATION_PROPERTIES);
}
use of org.apache.commons.configuration.PropertiesConfiguration in project incubator-atlas by apache.
the class AtlasAuthenticationKerberosFilterTest method generateKerberosTestProperties.
protected String generateKerberosTestProperties() throws Exception {
PropertiesConfiguration props = new PropertiesConfiguration();
props.setProperty("atlas.http.authentication.enabled", "true");
props.setProperty("atlas.http.authentication.type", "kerberos");
props.setProperty("atlas.http.authentication.kerberos.principal", "HTTP/localhost@" + kdc.getRealm());
props.setProperty("atlas.http.authentication.kerberos.keytab", httpKeytabFile.getAbsolutePath());
props.setProperty("atlas.http.authentication.kerberos.name.rules", "RULE:[1:$1@$0](.*@EXAMPLE.COM)s/@.*//\nDEFAULT");
return writeConfiguration(props);
}
use of org.apache.commons.configuration.PropertiesConfiguration in project incubator-atlas by apache.
the class SecureEmbeddedServerTestBase method runOtherSuitesAgainstSecureServer.
/**
* Runs the existing webapp test cases, this time against the initiated secure server instance.
* @throws Exception
*/
@Test
public void runOtherSuitesAgainstSecureServer() throws Exception {
final PropertiesConfiguration configuration = new PropertiesConfiguration();
configuration.setProperty(CERT_STORES_CREDENTIAL_PROVIDER_PATH, providerUrl);
// setup the credential provider
setupCredentials();
try {
secureEmbeddedServer = new SecureEmbeddedServer(securePort, TestUtils.getWarPath()) {
@Override
protected PropertiesConfiguration getConfiguration() {
return configuration;
}
};
secureEmbeddedServer.server.start();
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setTestClasses(new Class[] { AdminJerseyResourceIT.class, EntityJerseyResourceIT.class, MetadataDiscoveryJerseyResourceIT.class, TypesJerseyResourceIT.class });
testng.addListener(tla);
testng.run();
} finally {
secureEmbeddedServer.server.stop();
}
}
use of org.apache.commons.configuration.PropertiesConfiguration in project incubator-atlas by apache.
the class NegativeSSLAndKerberosTest method setUp.
@BeforeClass
public void setUp() throws Exception {
jksPath = new Path(Files.createTempDirectory("tempproviders").toString(), "test.jks");
providerUrl = JavaKeyStoreProvider.SCHEME_NAME + "://file/" + jksPath.toUri();
String persistDir = TestUtils.getTempDirectory();
setupKDCAndPrincipals();
setupCredentials();
// client will actually only leverage subset of these properties
final PropertiesConfiguration configuration = getSSLConfiguration(providerUrl);
persistSSLClientConfiguration(configuration);
TestUtils.writeConfiguration(configuration, persistDir + File.separator + ApplicationProperties.APPLICATION_PROPERTIES);
String confLocation = System.getProperty("atlas.conf");
URL url;
if (confLocation == null) {
url = NegativeSSLAndKerberosTest.class.getResource("/" + ApplicationProperties.APPLICATION_PROPERTIES);
} else {
url = new File(confLocation, ApplicationProperties.APPLICATION_PROPERTIES).toURI().toURL();
}
configuration.load(url);
configuration.setProperty(TLS_ENABLED, true);
configuration.setProperty("atlas.authentication.method.kerberos", "true");
configuration.setProperty("atlas.authentication.keytab", userKeytabFile.getAbsolutePath());
configuration.setProperty("atlas.authentication.principal", "dgi/localhost@" + kdc.getRealm());
configuration.setProperty("atlas.authentication.method.file", "false");
configuration.setProperty("atlas.authentication.method.kerberos", "true");
configuration.setProperty("atlas.authentication.method.kerberos.principal", "HTTP/localhost@" + kdc.getRealm());
configuration.setProperty("atlas.authentication.method.kerberos.keytab", httpKeytabFile.getAbsolutePath());
configuration.setProperty("atlas.authentication.method.kerberos.name.rules", "RULE:[1:$1@$0](.*@EXAMPLE.COM)s/@.*//\nDEFAULT");
configuration.setProperty("atlas.authentication.method.file", "true");
configuration.setProperty("atlas.authentication.method.file.filename", persistDir + "/users-credentials");
configuration.setProperty("atlas.auth.policy.file", persistDir + "/policy-store.txt");
TestUtils.writeConfiguration(configuration, persistDir + File.separator + ApplicationProperties.APPLICATION_PROPERTIES);
setupUserCredential(persistDir);
setUpPolicyStore(persistDir);
// save original setting
originalConf = System.getProperty("atlas.conf");
System.setProperty("atlas.conf", persistDir);
dgiClient = new AtlasClient(configuration, DGI_URL);
secureEmbeddedServer = new TestSecureEmbeddedServer(21443, getWarPath()) {
@Override
public Configuration getConfiguration() {
return configuration;
}
};
secureEmbeddedServer.getServer().start();
}
Aggregations