Repository: wso2/product-microgateway
Issue: The error response of the blocked subscription should be fixed

### Description:
<!-- Describe the issue -->
The response for an api with blocked subscription error description says Subscription validation failed.

`{"error_message":"The requested API is temporarily blocked","code":"900907","error_description":"User is NOT authorized to access the Resource. API Subscription validation failed."}
`
This should be fixed to show the correct cause of the failure which is Blocked subscription in this case.

### Steps to reproduce:

### Affected Product Version:
<!-- Members can use Affected/*** labels -->

### Environment details (with versions):
- OS:
- Client:
- Env (Docker/K8s):

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->


Changed files:
enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/jwt/APIKeyAuthenticator.java
enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/FaultCodeClassifier.java
enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/APISecurityConstants.java
enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/jwt/JWTAuthenticator.java

diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/FaultCodeClassifier.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/FaultCodeClassifier.java
index 38e4b1869..7f84fec42 100644
--- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/FaultCodeClassifier.java
+++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/FaultCodeClassifier.java
@@ -70,7 +70,7 @@ public class FaultCodeClassifier {
             case APISecurityConstants.API_AUTH_INCORRECT_ACCESS_TOKEN_TYPE:
             case APISecurityConstants.INVALID_SCOPE:
                 return FaultSubCategories.Authentication.AUTHORIZATION_FAILURE;
-            case APISecurityConstants.API_BLOCKED:
+            case APISecurityConstants.API_SUBSCRIPTION_BLOCKED:
             case APISecurityConstants.API_AUTH_FORBIDDEN:
             case APISecurityConstants.SUBSCRIPTION_INACTIVE:
                 return FaultSubCategories.Authentication.SUBSCRIPTION_VALIDATION_FAILURE;
diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/APISecurityConstants.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/APISecurityConstants.java
index 9134f0e77..68a9df526 100644
--- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/APISecurityConstants.java
+++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/APISecurityConstants.java
@@ -53,8 +53,9 @@ public class APISecurityConstants {
     public static final String API_AUTH_INCORRECT_API_RESOURCE_DESCRIPTION = "Check the API documentation and add a "
             + "proper REST resource path to the invocation URL";
 
-    public static final int API_BLOCKED = 900907;
-    public static final String API_BLOCKED_MESSAGE = "The requested API is temporarily blocked";
+    public static final int API_SUBSCRIPTION_BLOCKED = 900907;
+    public static final String API_SUBSCRIPTION_BLOCKED_MESSAGE = "The requested API is temporarily blocked";
+    public static final String API_SUBSCRIPTION_BLOCKED_DESCRIPTION = "API Subscription is blocked";
 
     public static final int API_AUTH_FORBIDDEN = 900908;
     public static final String API_AUTH_FORBIDDEN_MESSAGE = "Resource forbidden ";
@@ -116,8 +117,8 @@ public class APISecurityConstants {
         case API_AUTH_INCORRECT_ACCESS_TOKEN_TYPE:
             errorMessage = API_AUTH_INCORRECT_ACCESS_TOKEN_TYPE_MESSAGE;
             break;
-        case API_BLOCKED:
-            errorMessage = API_BLOCKED_MESSAGE;
+        case API_SUBSCRIPTION_BLOCKED:
+            errorMessage = API_SUBSCRIPTION_BLOCKED_MESSAGE;
             break;
         case API_AUTH_FORBIDDEN:
             errorMessage = API_AUTH_FORBIDDEN_MESSAGE;
diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/jwt/APIKeyAuthenticator.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/jwt/APIKeyAuthenticator.java
index aa0fb985d..8be3f6d97 100644
--- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/jwt/APIKeyAuthenticator.java
+++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/jwt/APIKeyAuthenticator.java
@@ -193,6 +193,15 @@ public class APIKeyAuthenticator extends APIKeyHandler {
                         throw new APISecurityException(APIConstants.StatusCodes.SERVICE_UNAVAILABLE
                                 .getCode(), validationInfoDto.getValidationStatus(),
                                 GeneralErrorCodeConstants.API_BLOCKED_MESSAGE);
+                    } else if (APISecurityConstants.API_SUBSCRIPTION_BLOCKED == validationInfoDto
+                            .getValidationStatus()) {
+                        requestContext.getProperties().put(APIConstants.MessageFormat.ERROR_MESSAGE,
+                                APISecurityConstants.API_SUBSCRIPTION_BLOCKED_MESSAGE);
+                        requestContext.getProperties().put(APIConstants.MessageFormat.ERROR_DESCRIPTION,
+                                APISecurityConstants.API_SUBSCRIPTION_BLOCKED_DESCRIPTION);
+                        throw new APISecurityException(APIConstants.StatusCodes.UNAUTHENTICATED
+                                .getCode(), validationInfoDto.getValidationStatus(),
+                                APISecurityConstants.API_SUBSCRIPTION_BLOCKED_MESSAGE);
                     }
                     throw new APISecurityException(APIConstants.StatusCodes.UNAUTHORIZED.getCode(),
                             validationInfoDto.getValidationStatus(),
diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/jwt/JWTAuthenticator.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/jwt/JWTAuthenticator.java
index 265c67a27..215bc29b8 100644
--- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/jwt/JWTAuthenticator.java
+++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/jwt/JWTAuthenticator.java
@@ -225,6 +225,15 @@ public class JWTAuthenticator implements Authenticator {
                                         throw new APISecurityException(APIConstants.StatusCodes.SERVICE_UNAVAILABLE
                                                 .getCode(), apiKeyValidationInfoDTO.getValidationStatus(),
                                                 GeneralErrorCodeConstants.API_BLOCKED_MESSAGE);
+                                    } else if (APISecurityConstants.API_SUBSCRIPTION_BLOCKED == apiKeyValidationInfoDTO
+                                            .getValidationStatus()) {
+                                        requestContext.getProperties().put(APIConstants.MessageFormat.ERROR_MESSAGE,
+                                                APISecurityConstants.API_SUBSCRIPTION_BLOCKED_MESSAGE);
+                                        requestContext.getProperties().put(APIConstants.MessageFormat.ERROR_DESCRIPTION,
+                                                APISecurityConstants.API_SUBSCRIPTION_BLOCKED_DESCRIPTION);
+                                        throw new APISecurityException(APIConstants.StatusCodes.UNAUTHENTICATED
+                                                .getCode(), apiKeyValidationInfoDTO.getValidationStatus(),
+                                                APISecurityConstants.API_SUBSCRIPTION_BLOCKED_MESSAGE);
                                     }
                                     throw new APISecurityException(APIConstants.StatusCodes.UNAUTHORIZED.getCode(),
                                             apiKeyValidationInfoDTO.getValidationStatus(),
@@ -273,7 +282,7 @@ public class JWTAuthenticator implements Authenticator {
                             getJwtConfigurationDto();
                     if (backendJwtConfig.isEnabled()) {
                         JWTInfoDto jwtInfoDto = FilterUtils.generateJWTInfoDto(null, validationInfo,
-                                        apiKeyValidationInfoDTO, requestContext);
+                                apiKeyValidationInfoDTO, requestContext);
                         endUserToken = BackendJwtUtils.generateAndRetrieveJWTToken(jwtGenerator, jwtTokenIdentifier,
                                 jwtInfoDto, isGatewayTokenCacheEnabled);
                         // Set generated jwt token as a response header