use of org.apache.drill.exec.rpc.NonTransientRpcException in project drill by apache.
the class TestUserBitSaslCompatibility method testDisableDrillbitAuth_EnableClientEncryption.
/**
* Test showing failure before SASL handshake when Drillbit is not configured for authentication whereas client
* explicitly requested for encrypted connection.
* @throws Exception
*/
@Test
public void testDisableDrillbitAuth_EnableClientEncryption() throws Exception {
final DrillConfig newConfig = new DrillConfig(DrillConfig.create(cloneDefaultTestConfigProperties()).withValue(ExecConstants.USER_AUTHENTICATION_ENABLED, ConfigValueFactory.fromAnyRef(false)));
final Properties connectionProps = new Properties();
connectionProps.setProperty(DrillProperties.USER, "anonymous");
connectionProps.setProperty(DrillProperties.PASSWORD, "anything works!");
connectionProps.setProperty(DrillProperties.SASL_ENCRYPT, "true");
try {
updateTestCluster(1, newConfig, connectionProps);
fail();
} catch (Exception ex) {
assertTrue(ex.getCause() instanceof NonTransientRpcException);
assertTrue(!(ex.getCause().getCause() instanceof SaslException));
}
}
use of org.apache.drill.exec.rpc.NonTransientRpcException in project drill by apache.
the class TestUserBitSaslCompatibility method testEnableDrillbitAuth_DisableClientAuth.
/**
* Test showing failure in SASL handshake when Drillbit is configured for authentication only whereas client doesn't
* provide any security properties like username/password in this case.
* @throws Exception
*/
@Test
public void testEnableDrillbitAuth_DisableClientAuth() throws Exception {
final DrillConfig newConfig = new DrillConfig(DrillConfig.create(cloneDefaultTestConfigProperties()).withValue(ExecConstants.USER_AUTHENTICATION_ENABLED, ConfigValueFactory.fromAnyRef(true)).withValue(ExecConstants.USER_AUTHENTICATOR_IMPL, ConfigValueFactory.fromAnyRef(UserAuthenticatorTestImpl.TYPE)).withValue(ExecConstants.AUTHENTICATION_MECHANISMS, ConfigValueFactory.fromIterable(Lists.newArrayList("plain"))).withValue(ExecConstants.USER_ENCRYPTION_SASL_ENABLED, ConfigValueFactory.fromAnyRef(false)));
final Properties connectionProps = new Properties();
try {
updateTestCluster(1, newConfig, connectionProps);
fail();
} catch (Exception ex) {
assertTrue(ex.getCause() instanceof NonTransientRpcException);
assertTrue(ex.getCause().getCause() instanceof SaslException);
}
}
use of org.apache.drill.exec.rpc.NonTransientRpcException in project drill by apache.
the class TestUserBitSaslCompatibility method testEnableDrillbitEncryption_DisableClientAuth.
/**
* Test showing failure in SASL handshake when Drillbit is configured for encryption whereas client doesn't provide any
* security properties like username/password in this case.
* @throws Exception
*/
@Test
public void testEnableDrillbitEncryption_DisableClientAuth() throws Exception {
final DrillConfig newConfig = new DrillConfig(DrillConfig.create(cloneDefaultTestConfigProperties()).withValue(ExecConstants.USER_AUTHENTICATION_ENABLED, ConfigValueFactory.fromAnyRef(true)).withValue(ExecConstants.USER_AUTHENTICATOR_IMPL, ConfigValueFactory.fromAnyRef(UserAuthenticatorTestImpl.TYPE)).withValue(ExecConstants.AUTHENTICATION_MECHANISMS, ConfigValueFactory.fromIterable(Lists.newArrayList("plain"))).withValue(ExecConstants.USER_ENCRYPTION_SASL_ENABLED, ConfigValueFactory.fromAnyRef(true)));
final Properties connectionProps = new Properties();
connectionProps.setProperty(DrillProperties.USER, "anonymous");
connectionProps.setProperty(DrillProperties.PASSWORD, "anything works!");
try {
updateTestCluster(1, newConfig, connectionProps);
fail();
} catch (Exception ex) {
assertTrue(ex.getCause() instanceof NonTransientRpcException);
assertTrue(ex.getCause().getCause() instanceof SaslException);
}
}
Aggregations