This is an automated email from the ASF dual-hosted git repository.

technoboy pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new d55ad1a9f8f [improve] [ws] add cryptoKeyReaderFactoryClassName into 
the file websocket.conf (#20840)
d55ad1a9f8f is described below

commit d55ad1a9f8fb0124bdad29d2d281d90045a92a63
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`
---
 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 2e2824a838c..490cff2722e 100644
--- a/conf/websocket.conf
+++ b/conf/websocket.conf
@@ -194,3 +194,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 92b4238cddd..a5ec63045ba 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

Reply via email to