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 e72daf72573f..c2de31b11dc2 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 @@ -86,6 +86,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 {