diff --git a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/template/APIConfigContext.java b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/template/APIConfigContext.java index 4c74195a1476..43e54558ba2c 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/template/APIConfigContext.java +++ b/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/template/APIConfigContext.java @@ -87,6 +87,18 @@ private void setApiVelocityContext(API api, VelocityContext context) { } else { context.put("apiIsOauthProtected", Boolean.FALSE); } + //if API is secured with api_Key + if (apiSecurity != null && apiSecurity.contains(APIConstants.API_SECURITY_API_KEY)) { + context.put("apiIsApiKeyProtected", Boolean.TRUE); + } else { + context.put("apiIsApiKeyProtected", Boolean.FALSE); + } + //if API is secured with basic_auth + if (apiSecurity != null && apiSecurity.contains(APIConstants.API_SECURITY_BASIC_AUTH)) { + context.put("apiIsBasicAuthProtected", Boolean.TRUE); + } else { + context.put("apiIsBasicAuthProtected", Boolean.FALSE); + } if (api.isEnabledSchemaValidation()) { context.put("enableSchemaValidation", Boolean.TRUE); } else {