From a8bcbd57ec47e8f89ef157d9fdc69836373505cb Mon Sep 17 00:00:00 2001 From: Thisal Tennakoon Date: Wed, 6 Sep 2023 16:16:43 +0530 Subject: [PATCH] Update InboundWebsocketProcessorUtil.java --- .../websocket/utils/InboundWebsocketProcessorUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/inbound/websocket/utils/InboundWebsocketProcessorUtil.java b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/inbound/websocket/utils/InboundWebsocketProcessorUtil.java index 7ebd86a63c56..0da27237f552 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/inbound/websocket/utils/InboundWebsocketProcessorUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/inbound/websocket/utils/InboundWebsocketProcessorUtil.java @@ -31,6 +31,7 @@ import org.wso2.carbon.apimgt.gateway.handlers.Utils; import org.wso2.carbon.apimgt.gateway.handlers.WebsocketUtil; import org.wso2.carbon.apimgt.gateway.handlers.security.APIKeyValidator; +import org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityConstants; import org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException; import org.wso2.carbon.apimgt.gateway.handlers.security.jwt.JWTValidator; import org.wso2.carbon.apimgt.gateway.handlers.streaming.websocket.WebSocketApiConstants; @@ -333,7 +334,8 @@ public static InboundProcessorResponseDTO authenticateToken(InboundMessageContex } else if (inboundMessageContext.getRequestHeaders().get(APIConstants.API_KEY_HEADER_QUERY_PARAM) != null || inboundMessageContext.getApiKeyFromQueryParams() != null) { return new ApiKeyAuthenticator().authenticate(inboundMessageContext, authenticationType); } else { - return null; + throw new APISecurityException(APISecurityConstants.API_AUTH_GENERAL_ERROR, + APISecurityConstants.API_AUTH_GENERAL_ERROR_MESSAGE); } }