Search in sources :

Example 96 with PropertiesConfiguration

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();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) File(java.io.File) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) BaseSecurityTest(org.apache.atlas.web.security.BaseSecurityTest) Test(org.testng.annotations.Test)

Example 97 with PropertiesConfiguration

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);
}
Also used : PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration)

Example 98 with PropertiesConfiguration

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);
}
Also used : PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration)

Example 99 with PropertiesConfiguration

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();
    }
}
Also used : TestNG(org.testng.TestNG) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) TestListenerAdapter(org.testng.TestListenerAdapter) Test(org.testng.annotations.Test)

Example 100 with PropertiesConfiguration

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();
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.commons.configuration.Configuration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) AtlasClient(org.apache.atlas.AtlasClient) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) File(java.io.File) URL(java.net.URL) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)102 File (java.io.File)37 Configuration (org.apache.commons.configuration.Configuration)29 ConfigurationException (org.apache.commons.configuration.ConfigurationException)26 IOException (java.io.IOException)12 Test (org.testng.annotations.Test)11 BeforeClass (org.testng.annotations.BeforeClass)10 MetricsRegistry (com.yammer.metrics.core.MetricsRegistry)9 IndexLoadingConfigMetadata (com.linkedin.pinot.common.metadata.segment.IndexLoadingConfigMetadata)8 FileBasedInstanceDataManager (com.linkedin.pinot.core.data.manager.offline.FileBasedInstanceDataManager)8 CompositeConfiguration (org.apache.commons.configuration.CompositeConfiguration)7 FileInputStream (java.io.FileInputStream)6 URL (java.net.URL)6 ServerQueryExecutorV1Impl (com.linkedin.pinot.core.query.executor.ServerQueryExecutorV1Impl)5 ServerConf (com.linkedin.pinot.server.conf.ServerConf)5 FileNotFoundException (java.io.FileNotFoundException)5 Properties (java.util.Properties)5 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)4 ServerMetrics (com.linkedin.pinot.common.metrics.ServerMetrics)4 FileBasedInstanceDataManagerConfig (com.linkedin.pinot.core.data.manager.config.FileBasedInstanceDataManagerConfig)4