From 25190a9f93296f419b4a48391cd3c4b613e35055 Mon Sep 17 00:00:00 2001 From: Mevan Date: Mon, 21 Oct 2024 16:27:01 +0530 Subject: [PATCH] Enable Choreo API Key Authenticator for apiKey scheme --- .../wso2/choreo/connect/enforcer/constants/APIConstants.java | 1 - .../org/wso2/choreo/connect/enforcer/security/AuthFilter.java | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/APIConstants.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/APIConstants.java index 0b9aff58ff..e3fee1f08e 100644 --- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/APIConstants.java +++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/APIConstants.java @@ -48,7 +48,6 @@ public class APIConstants { public static final String API_SECURITY_MUTUAL_SSL = "mutualssl"; public static final String API_SECURITY_BASIC_AUTH = "basic_auth"; public static final String SWAGGER_API_KEY_AUTH_TYPE_NAME = "apiKey"; - public static final String API_SECURITY_CHOREO_API_KEY = "api_key"; public static final String SWAGGER_API_KEY_IN_HEADER = "header"; public static final String SWAGGER_API_KEY_IN_QUERY = "query"; public static final String API_SECURITY_MUTUAL_SSL_MANDATORY = "mutualssl_mandatory"; diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java index 2a76f4e64b..7721b6eaea 100644 --- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java +++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java @@ -88,9 +88,8 @@ private void initializeAuthenticators(APIConfig apiConfig) { equalsIgnoreCase(APIConstants.API_SECURITY_OAUTH_BASIC_AUTH_API_KEY_MANDATORY)) { isOAuthBasicAuthMandatory = true; } else if (apiSecurityLevel.trim().equalsIgnoreCase(APIConstants.SWAGGER_API_KEY_AUTH_TYPE_NAME)) { - isApiKeyProtected = true; - } else if (apiSecurityLevel.trim().equalsIgnoreCase(APIConstants.API_SECURITY_CHOREO_API_KEY)) { isChoreoApiKeyProtected = true; + isApiKeyProtected = true; } } }