isaacreath commented on code in PR #247:
URL: https://github.com/apache/cassandra-sidecar/pull/247#discussion_r2360052509


##########
server/src/test/java/org/apache/cassandra/sidecar/acl/authentication/ReloadingJwtAuthenticationHandlerTest.java:
##########
@@ -75,4 +95,102 @@ void testDelegateHandlerNotCreatedWhenJWTDisabled()
             assertThat(result.cause()).hasMessage("Service Unavailable");
         });
     }
+
+    @Test
+    void testStatelessJwtAuthenticationWithValidToken() throws Exception
+    {
+        // Generate a test RSA key pair and PEM
+        KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+        keyGen.initialize(2048);
+        KeyPair keyPair = keyGen.generateKeyPair();
+
+        String publicKeyPem = "-----BEGIN PUBLIC KEY-----\n" +
+                              
Base64.getEncoder().encodeToString(keyPair.getPublic().getEncoded()) +
+                              "\n-----END PUBLIC KEY-----";
+
+        Vertx vertx = Vertx.vertx();
+        try
+        {
+            // Mock HTTP server to serve the PEM
+            HttpServer mockServer = vertx.createHttpServer();
+            CountDownLatch serverLatch = new CountDownLatch(1);
+
+            mockServer.requestHandler(request -> {
+                request.response()
+                       .putHeader("Content-Type", "text/plain")
+                       .end(publicKeyPem);
+            }).listen(8080, result -> serverLatch.countDown());

Review Comment:
   Addressed in 
https://github.com/apache/cassandra-sidecar/pull/247/commits/895ea0636b1675a244d07dac8874542cab28e80b



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to