Skip to content

Commit 0a21d4e

Browse files
committed
Update gateway type validation
1 parent c23b039 commit 0a21d4e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@ public Response environmentsPost(EnvironmentDTO body, MessageContext messageCont
111111
//String tenantDomain = RestApiCommonUtil.getLoggedInUserTenantDomain();
112112
String organization = RestApiUtil.getValidatedOrganization(messageContext);
113113
String gatewayType = body.getGatewayType();
114-
//todo: temporarily disabling the gateway type validation
115-
// if (!(APIConstants.API_GATEWAY_TYPE_REGULAR.equals(gatewayType) || APIConstants.API_GATEWAY_TYPE_APK.equals(gatewayType))) {
116-
// throw new APIManagementException("Invalid gateway type: " + gatewayType);
117-
// }
114+
115+
List<String> gatewayTypes = APIUtil.getGatewayTypes();
116+
if (!gatewayTypes.contains(gatewayType)) {
117+
throw new APIManagementException("Invalid gateway type: " + gatewayType);
118+
}
119+
118120
if (APIConstants.API_GATEWAY_TYPE_APK.equals(gatewayType) && hasUnsupportedVhostConfiguration(body.getVhosts())) {
119121
throw new APIManagementException("Unsupported Vhost Configuration for gateway type: " + gatewayType);
120122
}

0 commit comments

Comments
 (0)