From 37065369c77884ed673cbaccd94c7dc7340a08fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Pi=C4=99ta?= Date: Thu, 13 Feb 2025 14:14:27 +0100 Subject: [PATCH] Added unprotected oauth endpoint in oauth e2e tests --- .../servicemesh/envoycontrol/JWTFilterTest.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/JWTFilterTest.kt b/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/JWTFilterTest.kt index 960fe9d1d..cde3777a4 100644 --- a/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/JWTFilterTest.kt +++ b/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/JWTFilterTest.kt @@ -93,6 +93,9 @@ class JWTFilterTest { incoming: unlistedEndpointsPolicy: blockAndLog endpoints: + - path: '/unprotected' + clients: ['echo2'] + unlistedClientsPolicy: blockAndLog - path: '/first-provider-protected' clients: ['echo2'] unlistedClientsPolicy: blockAndLog @@ -205,6 +208,22 @@ class JWTFilterTest { envoy.waitForReadyServices("oauth") } + @Test + fun `should allow request without jwt for unprotected endpoint`() { + + // given + registerEnvoyServiceAndWait() + + // when + val response = echo2Envoy.egressOperations.callService( + service = "echo", + pathAndQuery = "/unprotected" + ) + + // then + assertThat(response).isOk().isFrom(service) + } + @Test fun `should reject request without jwt`() {