This is an automated email from the ASF dual-hosted git repository.
yubiao pushed a commit to branch branch-2.11
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.11 by this push:
new 4845e39f6b5 [improve] [ws] add cryptoKeyReaderFactoryClassName into
the file websocket.conf (#20840)
4845e39f6b5 is described below
commit 4845e39f6b550510630d7dde22ad83866d53517e
Author: fengyubiao <[email protected]>
AuthorDate: Thu Jul 20 17:48:33 2023 +0800
[improve] [ws] add cryptoKeyReaderFactoryClassName into the file
websocket.conf (#20840)
Motivation: Since the PR https://github.com/apache/pulsar/pull/16234 add
the prop `cryptoKeyReaderFactoryClassName` for the WebSocket Proxy, but did not
add this prop to `websocket.conf`. This can make the script which try to
replacement attribute a bit difficult to write
Modifications: add the conf `cryptoKeyReaderFactoryClassName` into the file
`websocket.conf`
(cherry picked from commit 5d0aa5615df68ee6898d0c2e58006166b8a0a8bd)
---
conf/websocket.conf | 3 +++
.../org/apache/pulsar/websocket/WebSocketProxyConfigurationTest.java | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/conf/websocket.conf b/conf/websocket.conf
index 79dee8edeeb..1c10d2d9602 100644
--- a/conf/websocket.conf
+++ b/conf/websocket.conf
@@ -192,3 +192,6 @@ zooKeeperSessionTimeoutMillis=-1
# ZooKeeper cache expiry time in seconds
# Deprecated: use metadataStoreCacheExpirySeconds
zooKeeperCacheExpirySeconds=-1
+
+# CryptoKeyReader factory classname to support encryption at websocket.
+cryptoKeyReaderFactoryClassName=
diff --git
a/pulsar-websocket/src/test/java/org/apache/pulsar/websocket/WebSocketProxyConfigurationTest.java
b/pulsar-websocket/src/test/java/org/apache/pulsar/websocket/WebSocketProxyConfigurationTest.java
index d271dd43247..6ecbe53ede2 100644
---
a/pulsar-websocket/src/test/java/org/apache/pulsar/websocket/WebSocketProxyConfigurationTest.java
+++
b/pulsar-websocket/src/test/java/org/apache/pulsar/websocket/WebSocketProxyConfigurationTest.java
@@ -34,6 +34,7 @@ import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
public class WebSocketProxyConfigurationTest {
@@ -64,6 +65,7 @@ public class WebSocketProxyConfigurationTest {
printWriter.println("metadataStoreCacheExpirySeconds=500");
printWriter.println("zooKeeperSessionTimeoutMillis=-1");
printWriter.println("zooKeeperCacheExpirySeconds=-1");
+ printWriter.println("cryptoKeyReaderFactoryClassName=");
}
testConfigFile.deleteOnExit();
stream = new FileInputStream(testConfigFile);
@@ -71,6 +73,7 @@ public class WebSocketProxyConfigurationTest {
stream.close();
assertEquals(serviceConfig.getMetadataStoreSessionTimeoutMillis(), 60);
assertEquals(serviceConfig.getMetadataStoreCacheExpirySeconds(), 500);
+ assertNull(serviceConfig.getCryptoKeyReaderFactoryClassName());
testConfigFile = new File("tmp." + System.currentTimeMillis() +
".properties");
if (testConfigFile.exists()) {
@@ -81,6 +84,7 @@ public class WebSocketProxyConfigurationTest {
printWriter.println("metadataStoreCacheExpirySeconds=30");
printWriter.println("zooKeeperSessionTimeoutMillis=100");
printWriter.println("zooKeeperCacheExpirySeconds=300");
+ printWriter.println("cryptoKeyReaderFactoryClassName=A.class");
}
testConfigFile.deleteOnExit();
stream = new FileInputStream(testConfigFile);
@@ -88,6 +92,7 @@ public class WebSocketProxyConfigurationTest {
stream.close();
assertEquals(serviceConfig.getMetadataStoreSessionTimeoutMillis(),
100);
assertEquals(serviceConfig.getMetadataStoreCacheExpirySeconds(), 300);
+ assertEquals(serviceConfig.getCryptoKeyReaderFactoryClassName(),
"A.class");
}
@Test