use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class ExternalMTLSAuthenticationServerTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
URL serverTrustoreURL = ExternalMTLSAuthenticationServerTest.class.getClassLoader().getResource("server-trust.jks");
URL serverKeystoreURL = ExternalMTLSAuthenticationServerTest.class.getClassLoader().getResource("server-key.jks");
URL realmURL = ExternalMTLSAuthenticationServerTest.class.getClassLoader().getResource("realm.properties");
Assert.assertNotNull(serverTrustoreURL);
Assert.assertNotNull(serverKeystoreURL);
Assert.assertNotNull(realmURL);
CConfiguration cConf = CConfiguration.create();
SConfiguration sConf = SConfiguration.create();
cConf.set(Constants.Security.AUTH_SERVER_BIND_ADDRESS, "127.0.0.1");
// enables SSL
cConf.set(Constants.Security.SSL.EXTERNAL_ENABLED, "true");
cConf.set(Constants.Security.AuthenticationServer.SSL_PORT, "0");
// set up port for non-ssl endpoints
cConf.set(Constants.Security.AUTH_SERVER_BIND_PORT, "1");
// Configure the Custom Handler
cConf.set(AUTH_HANDLER_CONFIG_BASE.concat("ClassName"), "co.cask.cdap.security.server" + ".CertificateAuthenticationHandler");
// setup the realm file for Identity
cConf.set(AUTH_HANDLER_CONFIG_BASE.concat("realmfile"), realmURL.getPath());
cConf.set(Constants.Security.AuthenticationServer.SSL_TRUSTSTORE_PATH, serverTrustoreURL.getPath());
cConf.set(Constants.Security.AuthenticationServer.SSL_TRUSTSTORE_PASSWORD, "secret");
cConf.set(Constants.Security.AuthenticationServer.SSL_TRUSTSTORE_TYPE, "JKS");
// Setup the Server's Key Store
cConf.set(Constants.Security.AuthenticationServer.SSL_KEYSTORE_PATH, serverKeystoreURL.getPath());
sConf.set(Constants.Security.AuthenticationServer.SSL_KEYSTORE_PATH, serverKeystoreURL.getPath());
sConf.set(Constants.Security.AuthenticationServer.SSL_KEYSTORE_PASSWORD, "secret");
sConf.set(Constants.Security.AuthenticationServer.SSL_KEYPASSWORD, "secret");
sConf.set(Constants.Security.AuthenticationServer.SSL_KEYSTORE_TYPE, "JKS");
configuration = cConf;
sConfiguration = sConf;
testServer = new ExternalMTLSAuthenticationServerTest();
testServer.setup();
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class AuthorizerInstantiatorTest method testAuthorizationDisabled.
@Test
public void testAuthorizationDisabled() throws IOException {
CConfiguration cConf = CConfiguration.create();
cConf.setBoolean(Constants.Security.ENABLED, true);
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMPORARY_FOLDER.newFolder().getAbsolutePath());
assertDisabled(cConf, FeatureDisabledException.Feature.AUTHORIZATION);
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class AuthorizerInstantiatorTest method testAuthenticationDisabled.
@Test
public void testAuthenticationDisabled() throws IOException {
CConfiguration cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMPORARY_FOLDER.newFolder().getAbsolutePath());
cConf.setBoolean(Constants.Security.Authorization.ENABLED, true);
assertDisabled(cConf, FeatureDisabledException.Feature.AUTHENTICATION);
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class DefaultAuthorizationEnforcerTest method testAuthenticationDisabled.
@Test
public void testAuthenticationDisabled() throws Exception {
CConfiguration cConfCopy = CConfiguration.copy(CCONF);
cConfCopy.setBoolean(Constants.Security.ENABLED, false);
verifyDisabled(cConfCopy);
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class StandaloneTester method before.
@Override
protected void before() throws Throwable {
tmpFolder.create();
CConfiguration cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath());
cConf.set(Constants.Router.ADDRESS, getLocalHostname());
cConf.setInt(Constants.Router.ROUTER_PORT, Networks.getRandomPort());
cConf.setBoolean(Constants.Dangerous.UNRECOVERABLE_RESET, true);
cConf.setBoolean(Constants.Explore.EXPLORE_ENABLED, true);
cConf.setBoolean(Constants.Explore.START_ON_DEMAND, false);
cConf.setBoolean(StandaloneMain.DISABLE_UI, true);
cConf.setBoolean(Constants.Audit.ENABLED, false);
for (int i = 0; i < configs.length; i += 2) {
cConf.set(configs[i].toString(), configs[i + 1].toString());
}
this.cConf = cConf;
// Start standalone
standaloneMain = StandaloneMain.create(cConf, new Configuration());
standaloneMain.startUp();
try {
waitForStandalone();
} catch (Throwable t) {
standaloneMain.shutDown();
throw t;
}
}
Aggregations