Skip to content

Commit 6440dc8

Browse files
committed
Fix Sandbox API Key requests returning Production Response for API Products
1 parent e700138 commit 6440dc8

File tree

1 file changed

+12
-0
lines changed
  • components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/template

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,18 @@ private void setApiProductVelocityContext(APIProduct apiProduct, VelocityContext
138138
} else {
139139
context.put("apiIsOauthProtected", Boolean.FALSE);
140140
}
141+
// if API is secured with api_Key
142+
if (apiSecurity != null && apiSecurity.contains(APIConstants.API_SECURITY_API_KEY)) {
143+
context.put("apiIsApiKeyProtected", Boolean.TRUE);
144+
} else {
145+
context.put("apiIsApiKeyProtected", Boolean.FALSE);
146+
}
147+
// if API is secured with basic_auth
148+
if (apiSecurity != null && apiSecurity.contains(APIConstants.API_SECURITY_BASIC_AUTH)) {
149+
context.put("apiIsBasicAuthProtected", Boolean.TRUE);
150+
} else {
151+
context.put("apiIsBasicAuthProtected", Boolean.FALSE);
152+
}
141153
if (apiProduct.isEnabledSchemaValidation()) {
142154
context.put("enableSchemaValidation", Boolean.TRUE);
143155
} else {

0 commit comments

Comments
 (0)