Skip to content

Commit

Permalink
Merge pull request #1873 from dinusha92/main
Browse files Browse the repository at this point in the history
Enabling default CORS + tweak configs to work with APIM.
  • Loading branch information
Rajith90 authored Apr 9, 2021
2 parents 4c7657a + bd37f82 commit 316a221
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 21 deletions.
8 changes: 2 additions & 6 deletions distribution/src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@
<outputDirectory>choreo-connect-${project.version}/docker-compose/choreo-connect-with-apim/conf
</outputDirectory>
</file>
<file>
<source>../resources/docker-compose/apim/conf/config.toml</source>
<outputDirectory>choreo-connect-${project.version}/docker-compose/choreo-connect-with-apim/conf
</outputDirectory>
</file>
<file>
<source>../resources/conf/log4j2.properties</source>
<outputDirectory>choreo-connect-${project.version}/docker-compose/choreo-connect/conf</outputDirectory>
Expand All @@ -146,7 +141,8 @@
</file>
<file>
<source>../resources/conf/config-for-eventhub.toml</source>
<outputDirectory>choreo-connect-${project.version}/docker-compose/choreo-connect/conf</outputDirectory>
<outputDirectory>choreo-connect-${project.version}/docker-compose/choreo-connect-with-apim/conf
</outputDirectory>
<destName>config.toml</destName>
</file>
<file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,25 @@
*/
package org.wso2.choreo.connect.tests.testCaseBefore;

import java.io.File;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.wso2.choreo.connect.tests.common.BaseTestCase;
import org.wso2.choreo.connect.tests.context.MicroGWTestException;
import org.wso2.choreo.connect.tests.util.ApictlUtils;

import java.util.concurrent.TimeUnit;
import org.wso2.choreo.connect.tests.util.TestConstant;
import org.wso2.choreo.connect.tests.util.Utils;

public class MgwWithBackendTls extends BaseTestCase {

@BeforeTest(description = "initialise the setup")
void start() throws Exception {
super.startMGW(null, true);

String targetDir = Utils.getTargetDirPath();
String confPath = targetDir + TestConstant.TEST_RESOURCES_PATH + File.separator + "cors" + File.separator
+ "cors-disabled-config.toml";
super.startMGW(confPath, true);
ApictlUtils.createProject("backend_tsl_openAPI.yaml", "backend_tsl_petstore", "backend_tls.crt");
ApictlUtils.createProject( "cors_openAPI.yaml", "cors_petstore", null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ allowCredentials = false
[router.upstream.tls]
minimumProtocolVersion = "TLS1_1"
maximumProtocolVersion = "TLS1_2"
ciphers = "ECDHE-ECDSA-AES128-GCM-SHA256, ECDHE-RSA-AES128-GCM-SHA256, ECDHE-ECDSA-AES128-SHA, ECDHE-RSA-AES128-SHA, AES128-GCM-SHA256, AES128-SHA, ECDHE-ECDSA-AES256-GCM-SHA384, ECDHE-RSA-AES256-GCM-SHA384, ECDHE-ECDSA-AES256-SHA, ECDHE-RSA-AES256-SHA, AES256-GCM-SHA384, AES256-SHA"
ciphers = "ECDHE-ECDSA-AES128-GCM-SHA256, ECDHE-RSA-AES128-GCM-SHA256, ECDHE-ECDSA-AES128-SHA, ECDHE-RSA-AES128-SHA, AES128-GCM-SHA256, AES128-SHA, ECDHE-ECDSA-AES256-GCM-SHA384, ECDHE-RSA-AES256-GCM-SHA384, ECDHE-ECDSA-AES256-SHA, ECDHE-RSA-AES256-SHA, AES256-GCM-SHA384, AES256-SHA"
# the default endpoint certificates
trustedCertPath = "/etc/ssl/certs/ca-certificates.crt"
verifyHostName = true
Expand Down
4 changes: 2 additions & 2 deletions resources/conf/config-for-eventhub.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
keyPath = "/home/wso2/security/keystore/mg.key"

[router.cors]
enabled = false
enabled = true
allowOrigins = ["*"]
allowMethods = ["GET","PUT","POST","DELETE","PATCH","OPTIONS"]
allowHeaders = ["authorization","Access-Control-Allow-Origin","Content-Type","SOAPAction","apikey", "testKey", "Internal-Key"]
Expand Down Expand Up @@ -114,7 +114,7 @@ allowCredentials = false
# Throttling configurations
[enforcer.throttling]
# Connect with the central traffic manager
enableGlobalEventPublishing = false
enableGlobalEventPublishing = true
# Enable global advanced throttling based on request header conditions
enableHeaderConditions = false
# Enable global advanced throttling based on request query parameter conditions
Expand Down
4 changes: 2 additions & 2 deletions resources/conf/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
keyPath = "/home/wso2/security/keystore/mg.key"

[router.cors]
enabled = false
enabled = true
allowOrigins = ["*"]
allowMethods = ["GET","PUT","POST","DELETE","PATCH","OPTIONS"]
allowHeaders = ["authorization","Access-Control-Allow-Origin","Content-Type","SOAPAction","apikey", "testKey", "Internal-Key"]
Expand Down Expand Up @@ -114,7 +114,7 @@ allowCredentials = false
# Throttling configurations
[enforcer.throttling]
# Connect with the central traffic manager
enableGlobalEventPublishing = false
enableGlobalEventPublishing = true
# Enable global advanced throttling based on request header conditions
enableHeaderConditions = false
# Enable global advanced throttling based on request query parameter conditions
Expand Down
4 changes: 2 additions & 2 deletions resources/docker-compose/apim/conf/deployment.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ service_url = "https://apim:${mgt.transport.https.port}/services/"
#enable_token_encryption = false
#enable_token_hashing = false

#[apim.devportal]
#url = "https://localhost:${mgt.transport.https.port}/devportal"
[apim.devportal]
url = "https://apim:${mgt.transport.https.port}/devportal"
#enable_application_sharing = false
#if application_sharing_type, application_sharing_impl both defined priority goes to application_sharing_impl
#application_sharing_type = "default" #changed type, saml, default #todo: check the new config for rest api
Expand Down
8 changes: 4 additions & 4 deletions resources/k8s-artifacts/apim/apim-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ data:
password= "${admin.password}"
ws_endpoint = "ws://localhost:9099"
wss_endpoint = "wss://localhost:8099"
http_endpoint = "http://localhost:${http.nio.port}"
https_endpoint = "https://localhost:${https.nio.port}"
http_endpoint = "http://gw.wso2.com:30201"
https_endpoint = "https://gw.wso2.com:30201"
#[apim.cache.gateway_token]
#enable = true
Expand Down Expand Up @@ -149,8 +149,8 @@ data:
#enable_token_encryption = false
#enable_token_hashing = false
#[apim.devportal]
#url = "https://localhost:${mgt.transport.https.port}/devportal"
[apim.devportal]
url = "https://wso2apim:32001/devportal"
#enable_application_sharing = false
#if application_sharing_type, application_sharing_impl both defined priority goes to application_sharing_impl
#application_sharing_type = "default" #changed type, saml, default #todo: check the new config for rest api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ data:
keyPath = "/home/wso2/security/keystore/mg.key"
[router.cors]
enabled = false
enabled = true
allowOrigins = ["*"]
allowMethods = ["GET","PUT","POST","DELETE","PATCH","OPTIONS"]
allowHeaders = ["authorization","Access-Control-Allow-Origin","Content-Type","SOAPAction","apikey", "testKey", "Internal-Key"]
Expand Down Expand Up @@ -147,7 +147,7 @@ data:
# The message broker context factory
jmsConnectionInitialContextFactory = "org.wso2.andes.jndi.PropertiesFileInitialContextFactory"
# The message broker connection URL
jmsConnectionProviderUrl = "amqp://admin:admin@carbon/carbon?brokerlist='tcp://localhost:5672'"
jmsConnectionProviderUrl = "amqp://admin:admin@carbon/carbon?brokerlist='tcp://wso2apim:5672'"
# Throttling configurations related to event publishing using a binary connection
[enforcer.throttling.publisher]
# Credentials required to establish connection between Traffic Manager
Expand Down

0 comments on commit 316a221

Please sign in to comment.