From 36102654e9e09d17074f61d0ec8479d203a1b4f1 Mon Sep 17 00:00:00 2001 From: Tharsanan1 Date: Tue, 5 Mar 2024 17:25:55 +0530 Subject: [PATCH] Revert "Add integration test for audience validation" This reverts commit eeeb6c11d157872b76109a65a348f2dca983f618. --- .../ballerina/TokenUtil.bal | 3 +- .../tests/jwt-resource-level-security-test.go | 42 +----------- .../tests/jwt-resource-level-security.yaml | 66 ------------------- 3 files changed, 2 insertions(+), 109 deletions(-) diff --git a/idp/idp-domain-service/ballerina/TokenUtil.bal b/idp/idp-domain-service/ballerina/TokenUtil.bal index 902acd34b..38e480164 100644 --- a/idp/idp-domain-service/ballerina/TokenUtil.bal +++ b/idp/idp-domain-service/ballerina/TokenUtil.bal @@ -114,8 +114,7 @@ public class TokenUtil { keyId: issuerConfiguration.keyId, signatureConfig: { config: {keyFile: idpConfiguration.keyStores.signing.keyFile} - }, - audience: "aud1" + } }; if username is string { issuerConfig.username = username; diff --git a/test/integration/integration/tests/jwt-resource-level-security-test.go b/test/integration/integration/tests/jwt-resource-level-security-test.go index 62c9eb2b0..679e6018b 100644 --- a/test/integration/integration/tests/jwt-resource-level-security-test.go +++ b/test/integration/integration/tests/jwt-resource-level-security-test.go @@ -92,47 +92,7 @@ var ResourceLevelJWT = suite.IntegrationTest{ }, Backend: "infra-backend-v1", Namespace: ns, - Response: http.Response{StatusCode: 401}, - }, - // Test wrong audience - { - Request: http.Request{ - Host: "resource-level-jwt.test.gw.wso2.com", - Path: "/resource-level-jwt/v1.0.0/v2/echo-1", - Headers: map[string]string{ - "content-type": "application/json", - "internal-key": token, - }, - Method: "GET", - }, - ExpectedRequest: &http.ExpectedRequest{ - Request: http.Request{ - Path: "/v2/echo-1", - }, - }, - Backend: "infra-backend-v1", - Namespace: ns, - Response: http.Response{StatusCode: 401}, - }, - // Test correct audience - { - Request: http.Request{ - Host: "resource-level-jwt.test.gw.wso2.com", - Path: "/resource-level-jwt/v1.0.0/v2/echo-2", - Headers: map[string]string{ - "content-type": "application/json", - "internal-key": token, - }, - Method: "GET", - }, - ExpectedRequest: &http.ExpectedRequest{ - Request: http.Request{ - Path: "/v2/echo-2", - }, - }, - Backend: "infra-backend-v1", - Namespace: ns, - Response: http.Response{StatusCode: 200}, + Response: http.Response{StatusCode: 401}, }, } for i := range testCases { diff --git a/test/integration/integration/tests/resources/tests/jwt-resource-level-security.yaml b/test/integration/integration/tests/resources/tests/jwt-resource-level-security.yaml index 529b48aa5..889b12c4c 100644 --- a/test/integration/integration/tests/resources/tests/jwt-resource-level-security.yaml +++ b/test/integration/integration/tests/resources/tests/jwt-resource-level-security.yaml @@ -60,34 +60,6 @@ spec: group: dp.wso2.com kind: Authentication name: resource-level-jwt-authentication - - matches: - - path: - type: PathPrefix - value: /v2/echo-1 - backendRefs: - - group: dp.wso2.com - kind: Backend - name: infra-backend-v1 - filters: - - type: ExtensionRef - extensionRef: - group: dp.wso2.com - kind: Authentication - name: resource-level-jwt-authentication-1 - - matches: - - path: - type: PathPrefix - value: /v2/echo-2 - backendRefs: - - group: dp.wso2.com - kind: Backend - name: infra-backend-v1 - filters: - - type: ExtensionRef - extensionRef: - group: dp.wso2.com - kind: Authentication - name: resource-level-jwt-authentication-2 --- apiVersion: dp.wso2.com/v1alpha2 kind: Authentication @@ -106,44 +78,6 @@ spec: group: gateway.networking.k8s.io namespace: gateway-integration-test-infra --- -apiVersion: dp.wso2.com/v1alpha2 -kind: Authentication -metadata: - name: resource-level-jwt-authentication-1 - namespace: gateway-integration-test-infra -spec: - override: - disabled: false - authTypes: - jwt: - disabled: false - audience: - - "test" - targetRef: - kind: Resource - name: resource-level-jwt - group: gateway.networking.k8s.io - namespace: gateway-integration-test-infra ---- -apiVersion: dp.wso2.com/v1alpha2 -kind: Authentication -metadata: - name: resource-level-jwt-authentication-2 - namespace: gateway-integration-test-infra -spec: - override: - disabled: false - authTypes: - jwt: - disabled: false - audience: - - "aud1" - targetRef: - kind: Resource - name: resource-level-jwt - group: gateway.networking.k8s.io - namespace: gateway-integration-test-infra ---- apiVersion: dp.wso2.com/v1alpha1 kind: Backend metadata: