use of org.apache.pulsar.metadata.impl.ZKMetadataStore in project pulsar by apache.
the class SimpleProxyExtensionTestBase method setup.
@BeforeClass
@Override
protected void setup() throws Exception {
tempDirectory = Files.createTempDirectory("SimpleProxyExtensionTest").toFile();
super.internalSetup();
proxyConfig.setUseSeparateThreadPoolForProxyExtensions(useSeparateThreadPoolForProxyExtensions);
proxyConfig.setProxyExtensionsDirectory(tempDirectory.getAbsolutePath());
proxyConfig.setProxyExtensions(Collections.singleton("test"));
buildMockNarFile(tempDirectory);
proxyConfig.setServicePort(Optional.ofNullable(0));
proxyConfig.setBrokerProxyAllowedTargetPorts("*");
proxyConfig.setMetadataStoreUrl(DUMMY_VALUE);
proxyConfig.setConfigurationMetadataStoreUrl(GLOBAL_DUMMY_VALUE);
proxyService = Mockito.spy(new ProxyService(proxyConfig, new AuthenticationService(PulsarConfigurationLoader.convertFrom(proxyConfig))));
doReturn(new ZKMetadataStore(mockZooKeeper)).when(proxyService).createLocalMetadataStore();
doReturn(new ZKMetadataStore(mockZooKeeperGlobal)).when(proxyService).createConfigurationMetadataStore();
proxyService.start();
}
use of org.apache.pulsar.metadata.impl.ZKMetadataStore in project pulsar by apache.
the class ProxyEnableHAProxyProtocolTest method setup.
@Override
@BeforeClass
protected void setup() throws Exception {
conf.setHaProxyProtocolEnabled(true);
internalSetup();
proxyConfig.setServicePort(Optional.ofNullable(0));
proxyConfig.setBrokerProxyAllowedTargetPorts("*");
proxyConfig.setMetadataStoreUrl(DUMMY_VALUE);
proxyConfig.setConfigurationMetadataStoreUrl(GLOBAL_DUMMY_VALUE);
proxyConfig.setHaProxyProtocolEnabled(true);
proxyService = Mockito.spy(new ProxyService(proxyConfig, new AuthenticationService(PulsarConfigurationLoader.convertFrom(proxyConfig))));
doReturn(new ZKMetadataStore(mockZooKeeper)).when(proxyService).createLocalMetadataStore();
doReturn(new ZKMetadataStore(mockZooKeeperGlobal)).when(proxyService).createConfigurationMetadataStore();
proxyService.start();
}
use of org.apache.pulsar.metadata.impl.ZKMetadataStore in project pulsar by apache.
the class ProxyTest method setup.
@Override
@BeforeClass
protected void setup() throws Exception {
internalSetup();
proxyConfig.setServicePort(Optional.ofNullable(0));
proxyConfig.setBrokerProxyAllowedTargetPorts("*");
proxyConfig.setMetadataStoreUrl(DUMMY_VALUE);
proxyConfig.setConfigurationMetadataStoreUrl(GLOBAL_DUMMY_VALUE);
proxyService = Mockito.spy(new ProxyService(proxyConfig, new AuthenticationService(PulsarConfigurationLoader.convertFrom(proxyConfig))));
doReturn(new ZKMetadataStore(mockZooKeeper)).when(proxyService).createLocalMetadataStore();
doReturn(new ZKMetadataStore(mockZooKeeperGlobal)).when(proxyService).createConfigurationMetadataStore();
proxyService.start();
}
use of org.apache.pulsar.metadata.impl.ZKMetadataStore in project pulsar by apache.
the class ProxyTlsTestWithAuth method setup.
@Override
@BeforeClass
protected void setup() throws Exception {
internalSetup();
File tempFile = File.createTempFile("oauth2", ".tmp");
tempFile.deleteOnExit();
FileWriter writer = new FileWriter(tempFile);
writer.write("{\n" + " \"client_id\":\"Xd23RHsUnvUlP7wchjNYOaIfazgeHd9x\",\n" + " \"client_secret\":\"rT7ps7WY8uhdVuBTKWZkttwLdQotmdEliaM5rLfmgNibvqziZ-g07ZH52N_poGAb\"\n" + "}");
writer.flush();
writer.close();
proxyConfig.setServicePort(Optional.of(0));
proxyConfig.setBrokerProxyAllowedTargetPorts("*");
proxyConfig.setServicePortTls(Optional.of(0));
proxyConfig.setWebServicePort(Optional.of(0));
proxyConfig.setWebServicePortTls(Optional.of(0));
proxyConfig.setTlsEnabledWithBroker(true);
proxyConfig.setTlsCertificateFilePath(TLS_PROXY_CERT_FILE_PATH);
proxyConfig.setTlsKeyFilePath(TLS_PROXY_KEY_FILE_PATH);
proxyConfig.setMetadataStoreUrl(DUMMY_VALUE);
proxyConfig.setConfigurationMetadataStoreUrl(GLOBAL_DUMMY_VALUE);
proxyConfig.setBrokerClientAuthenticationPlugin("org.apache.pulsar.client.impl.auth.oauth2.AuthenticationOAuth2");
proxyConfig.setBrokerClientAuthenticationParameters("{\"grant_type\":\"client_credentials\"," + " \"issuerUrl\":\"https://dev-kt-aa9ne.us.auth0.com\"," + " \"audience\": \"https://dev-kt-aa9ne.us.auth0.com/api/v2/\"," + " \"privateKey\":\"file://" + tempFile.getAbsolutePath() + "\"}");
proxyService = Mockito.spy(new ProxyService(proxyConfig, new AuthenticationService(PulsarConfigurationLoader.convertFrom(proxyConfig))));
doReturn(new ZKMetadataStore(mockZooKeeper)).when(proxyService).createLocalMetadataStore();
doReturn(new ZKMetadataStore(mockZooKeeperGlobal)).when(proxyService).createConfigurationMetadataStore();
proxyService.start();
}
use of org.apache.pulsar.metadata.impl.ZKMetadataStore in project pulsar by apache.
the class ProxyKeyStoreTlsTestWithAuth method setup.
@Override
@BeforeMethod
protected void setup() throws Exception {
internalSetup();
proxyConfig.setServicePort(Optional.of(0));
proxyConfig.setBrokerProxyAllowedTargetPorts("*");
proxyConfig.setServicePortTls(Optional.of(0));
proxyConfig.setWebServicePort(Optional.of(0));
proxyConfig.setWebServicePortTls(Optional.of(0));
proxyConfig.setTlsEnabledWithBroker(false);
proxyConfig.setTlsEnabledWithKeyStore(true);
proxyConfig.setTlsKeyStoreType(KEYSTORE_TYPE);
proxyConfig.setTlsKeyStore(BROKER_KEYSTORE_FILE_PATH);
proxyConfig.setTlsKeyStorePassword(BROKER_KEYSTORE_PW);
proxyConfig.setTlsTrustStoreType(KEYSTORE_TYPE);
proxyConfig.setTlsTrustStore(CLIENT_TRUSTSTORE_FILE_PATH);
proxyConfig.setTlsTrustStorePassword(CLIENT_TRUSTSTORE_PW);
proxyConfig.setMetadataStoreUrl(DUMMY_VALUE);
proxyConfig.setConfigurationMetadataStoreUrl(GLOBAL_DUMMY_VALUE);
// config for authentication and authorization.
proxyConfig.setTlsRequireTrustedClientCertOnConnect(true);
proxyConfig.setSuperUserRoles(Sets.newHashSet(CLIENT_KEYSTORE_CN));
proxyConfig.setAuthenticationEnabled(true);
proxyConfig.setAuthorizationEnabled(true);
Set<String> providers = new HashSet<>();
providers.add(AuthenticationProviderTls.class.getName());
proxyConfig.setAuthenticationProviders(providers);
proxyService = Mockito.spy(new ProxyService(proxyConfig, new AuthenticationService(PulsarConfigurationLoader.convertFrom(proxyConfig))));
doReturn(new ZKMetadataStore(mockZooKeeper)).when(proxyService).createLocalMetadataStore();
doReturn(new ZKMetadataStore(mockZooKeeperGlobal)).when(proxyService).createConfigurationMetadataStore();
proxyService.start();
}
Aggregations