├── .trivyignore ├── envoy-filters ├── .bazelversion ├── .bazelrc ├── bazel │ └── get_workspace_status ├── mgw-source │ └── filters │ │ └── http │ │ └── mgw-wasm-websocket │ │ ├── .bazelversion │ │ └── BUILD ├── mgw-api │ └── extensions │ │ └── filters │ │ └── http │ │ └── mgw-wasm-websocket │ │ └── v3 │ │ ├── WORKSPACE │ │ ├── config.proto │ │ └── BUILD ├── .clang-format ├── BUILD ├── WORKSPACE ├── .circleci │ └── config.yml └── ci │ └── do_ci.sh ├── samples ├── interceptors │ ├── .gitignore │ ├── golang │ │ ├── go-interceptor-server-generated │ │ │ ├── .gitignore │ │ │ ├── .swagger-codegen │ │ │ │ └── VERSION │ │ │ └── go │ │ │ │ ├── model_dynamic_endpoint.go │ │ │ │ ├── model_invocation_context_authentication_context.go │ │ │ │ ├── model_request_handler_request_body.go │ │ │ │ ├── logger.go │ │ │ │ ├── README.md │ │ │ │ ├── model_response_handler_response_body.go │ │ │ │ └── model_response_handler_request_body.go │ │ └── build.sh │ ├── java │ │ ├── spring-server-generated │ │ │ ├── .swagger-codegen │ │ │ │ └── VERSION │ │ │ ├── .gitignore │ │ │ ├── src │ │ │ │ └── main │ │ │ │ │ └── java │ │ │ │ │ └── io │ │ │ │ │ └── swagger │ │ │ │ │ ├── api │ │ │ │ │ ├── ApiException.java │ │ │ │ │ ├── NotFoundException.java │ │ │ │ │ └── ApiOriginFilter.java │ │ │ │ │ ├── configuration │ │ │ │ │ ├── HomeController.java │ │ │ │ │ ├── LocalDateConverter.java │ │ │ │ │ ├── LocalDateTimeConverter.java │ │ │ │ │ └── JacksonConfiguration.java │ │ │ │ │ └── RFC3339DateFormat.java │ │ │ ├── README.md │ │ │ └── Dockerfile │ │ └── build.sh │ ├── nodejs │ │ ├── nodejs-interceptor-server-generated │ │ │ ├── .gitignore │ │ │ ├── .swagger-codegen │ │ │ │ └── VERSION │ │ │ ├── .dockerignore │ │ │ ├── controllers │ │ │ │ ├── Request.js │ │ │ │ └── Response.js │ │ │ ├── package.json │ │ │ ├── README.md │ │ │ └── utils │ │ │ │ └── writer.js │ │ └── build.sh │ ├── ballerina │ │ └── cc-sample-xml-interceptor │ │ │ ├── .gitignore │ │ │ ├── Ballerina.toml │ │ │ └── Cloud.toml │ ├── sample-backend │ │ ├── cc-sample-legacy-xml-backend │ │ │ ├── .gitignore │ │ │ ├── Cloud.toml │ │ │ └── Ballerina.toml │ │ └── README.md │ ├── wso2-micro-integrator │ │ └── InterceptorServiceWithMI │ │ │ ├── InterceptorServiceWithMIDockerExporter │ │ │ ├── .gitignore │ │ │ ├── Resources │ │ │ │ ├── wso2carbon.jks │ │ │ │ └── client-truststore.jks │ │ │ ├── CompositeApps │ │ │ │ └── InterceptorServiceWithMICompositeExporter-1.0.0.car │ │ │ ├── Dockerfile │ │ │ └── deployment.toml │ │ │ ├── InterceptorServiceWithMICompositeExporter │ │ │ └── .gitignore │ │ │ └── InterceptorServiceWithMIConfigs │ │ │ └── artifact.xml │ ├── resources │ │ └── interceptor.jks │ └── README.md ├── istio │ ├── service-to-service │ │ ├── microservices │ │ │ ├── schedules-service │ │ │ │ ├── .gitignore │ │ │ │ ├── Cloud.toml │ │ │ │ └── Ballerina.toml │ │ │ └── trains-service │ │ │ │ ├── .gitignore │ │ │ │ ├── Cloud.toml │ │ │ │ ├── Ballerina.toml │ │ │ │ └── types.bal │ │ └── east-west-traffic.png │ ├── mtls-mode │ │ ├── mtls.jpg │ │ ├── openAPI.yaml │ │ └── create-certs.sh │ ├── sidecar-mode │ │ ├── sidecar.jpg │ │ └── openAPI.yaml │ └── README.md ├── filters │ ├── basic-auth-filter │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── org.wso2.choreo.connect.enforcer.commons.Filter │ └── sample-filter │ │ └── src │ │ └── main │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.wso2.choreo.connect.enforcer.commons.Filter ├── apiProjects │ ├── SampleSOAPApi │ │ ├── api_meta.yaml │ │ ├── deployment_environments.yaml │ │ └── api.yaml │ ├── SampleGraphQLApi │ │ └── Definitions │ │ │ └── schema.graphql │ └── SampleWebsocketApi │ │ └── Definitions │ │ └── asyncapi.yaml ├── rest-to-soap-conversion │ └── PhoneVerification │ │ ├── README.md │ │ ├── .project │ │ ├── PhoneVerificationConfigs │ │ ├── .project │ │ ├── src │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── metadata │ │ │ │ ├── PhoneVerify_metadata.yaml │ │ │ │ └── PhoneVerify_swagger.yaml │ │ └── artifact.xml │ │ └── PhoneVerificationCompositeExporter │ │ └── .project └── openAPI-definitions │ └── http2_sample.yaml ├── .fossa.yml ├── Architecture.png ├── integration ├── test-integration │ └── src │ │ ├── main │ │ └── resources │ │ │ ├── project.properties │ │ │ └── META-INF │ │ │ └── services │ │ │ ├── org.wso2.choreo.connect.enforcer.commons.Filter │ │ │ ├── org.wso2.carbon.apimgt.common.gateway.jwttransformer.JWTTransformer │ │ │ └── org.wso2.choreo.connect.enforcer.commons.opa.OPARequestGenerator │ │ └── test │ │ ├── resources │ │ ├── apim │ │ │ ├── 1 │ │ │ │ ├── apiToVhosts.json │ │ │ │ ├── apiToAsyncAPI.json │ │ │ │ ├── apiToOpenAPI.json │ │ │ │ ├── admin │ │ │ │ │ └── throttle │ │ │ │ │ │ ├── advanced │ │ │ │ │ │ ├── 5ReqPerMin.json │ │ │ │ │ │ └── 3KbPerMin.json │ │ │ │ │ │ ├── application │ │ │ │ │ │ ├── 5ReqPerMin.json │ │ │ │ │ │ └── 3KbPerMin.json │ │ │ │ │ │ └── subscription │ │ │ │ │ │ └── 5EventsPerMin.json │ │ │ │ └── apis │ │ │ │ │ ├── Http1API.json │ │ │ │ │ ├── BlockedAPI.json │ │ │ │ │ ├── Http2SecuredAPI.json │ │ │ │ │ ├── JwtScopeAPI.json │ │ │ │ │ ├── VHostAPI2.json │ │ │ │ │ ├── Http2ClearTextAPI.json │ │ │ │ │ ├── AdvancedThrottlingAPI.json │ │ │ │ │ ├── SubscriptionValidationAPI.json │ │ │ │ │ ├── ApplicationThrottlingAPI.json │ │ │ │ │ ├── EndpointWithTrailingSlashAPI.json │ │ │ │ │ ├── APIKeyTestAPI.json │ │ │ │ │ ├── APIKeyBlockedAPI.json │ │ │ │ │ ├── WebSocketBasicAPI.json │ │ │ │ │ ├── WebSocketTopicAPI.json │ │ │ │ │ ├── EnvoyHttpFilterAPI.json │ │ │ │ │ ├── APIKeyAppLevelThrottleAPI.json │ │ │ │ │ ├── VHostAPI1.json │ │ │ │ │ ├── WebSocketSecurityDisabledAPI.json │ │ │ │ │ ├── ExistingAPI.json │ │ │ │ │ ├── WebsocketApiLevelBandwidthThrottleAPI.json │ │ │ │ │ ├── WebsocketApiLevelEventCountThrottleAPI.json │ │ │ │ │ ├── WebsocketSubscriptionThrottleAPI.json │ │ │ │ │ ├── RetryAPI.json │ │ │ │ │ ├── TimeoutAPI.json │ │ │ │ │ └── BackendSecurityAPI.json │ │ │ └── 2 │ │ │ │ ├── apiToAsyncAPI.json │ │ │ │ ├── apis │ │ │ │ ├── KeyTemplateThrottlingAPI.json │ │ │ │ ├── GraphQLScopeAPI.json │ │ │ │ ├── SoapAPI.json │ │ │ │ ├── GraphQLThrottlingAPI.json │ │ │ │ ├── CompressionTestAPI.json │ │ │ │ ├── GraphQLAPI.json │ │ │ │ ├── WebSocketTimeoutAPI.json │ │ │ │ └── WebSocketScopeAPI.json │ │ │ │ ├── apps │ │ │ │ └── applications.json │ │ │ │ └── subscriptions │ │ │ │ └── subscriptions.json │ │ ├── policies │ │ │ ├── rewriteResourcePath_v1.j2 │ │ │ ├── ccRemoveHeader_v1.gotmpl │ │ │ ├── ccAddHeader_v1.gotmpl │ │ │ ├── addQueryParam_v1.gotmpl │ │ │ ├── customAddHeader_v2.gotmpl │ │ │ ├── customAddHeader_v1.gotmpl │ │ │ ├── ccChangeHTTPMethod_v1.gotmpl │ │ │ ├── ccCallInterceptorService_v1.gotmpl │ │ │ ├── rewriteResourcePath_v1.gotmpl │ │ │ ├── addQueryParam_v1.j2 │ │ │ ├── customAddHeader_v2.yaml │ │ │ ├── ccRemoveHeader_v1.yaml │ │ │ ├── opaPolicy_v1.gotmpl │ │ │ ├── ccAddHeader_v1.yaml │ │ │ ├── addQueryParam_v1.yaml │ │ │ ├── customAddHeader_v1.yaml │ │ │ ├── customOpaPolicy_v1.gotmpl │ │ │ ├── customOpaPolicy_v2.gotmpl │ │ │ ├── rewriteResourcePath_v1.yaml │ │ │ └── opaPolicy_v1.j2 │ │ ├── configs │ │ │ ├── aws-lambda-config.toml │ │ │ ├── mtls-enabled-config.toml │ │ │ ├── client-cert-encode-config.toml │ │ │ └── client-cert-not-encode-config.toml │ │ ├── keystore │ │ │ ├── wso2carbon.jks │ │ │ ├── client-keystore.jks │ │ │ ├── client-truststore.jks │ │ │ └── invalid-client-keystore.jks │ │ ├── database │ │ │ ├── WSO2AM_DB.mv.db │ │ │ ├── WSO2MB_DB.mv.db │ │ │ ├── WSO2CARBON_DB.mv.db │ │ │ ├── WSO2SHARED_DB.mv.db │ │ │ └── WSO2METRICS_DB.mv.db │ │ ├── git-artifacts │ │ │ ├── zip │ │ │ │ └── petstore1 │ │ │ │ │ ├── api_meta.yaml │ │ │ │ │ ├── deployment_environments.yaml │ │ │ │ │ ├── api.yaml │ │ │ │ │ └── Definitions │ │ │ │ │ └── swagger.yaml │ │ │ ├── directory │ │ │ │ └── petstore │ │ │ │ │ ├── api_meta.yaml │ │ │ │ │ ├── deployment_environments.yaml │ │ │ │ │ └── api.yaml │ │ │ └── updated │ │ │ │ └── petstore │ │ │ │ └── Definitions │ │ │ │ └── swagger.yaml │ │ ├── dockerVolumeMounts │ │ │ ├── gitea │ │ │ │ └── gitea │ │ │ │ │ └── gitea.db │ │ │ └── opa-volume │ │ │ │ └── policies │ │ │ │ ├── custom-policy.rego │ │ │ │ └── sample-policy.rego │ │ ├── policiesInvalid │ │ │ ├── ccAddHeaderNotSupportedParam_v1.gotmpl │ │ │ ├── ccAddHeaderNotSupportedAction_v1.gotmpl │ │ │ ├── ccAddHeaderNotSupportedParam_v1.yaml │ │ │ └── ccAddHeaderNotSupportedAction_v1.yaml │ │ ├── deploymentEnvironments │ │ │ ├── vhost2_deploy_env.yaml │ │ │ ├── vhost1_deploy_env.yaml │ │ │ ├── apictl_test_deploy_multiple_env.yaml │ │ │ └── apictl_test_deploy_env.yaml │ │ ├── dockerCompose │ │ │ ├── backend-service.yaml │ │ │ ├── backend-service-gql.yaml │ │ │ ├── git-service.yaml │ │ │ ├── apim-in-common-network-docker-compose.yaml │ │ │ └── backend-service-with-tls-and-network.yaml │ │ ├── certs │ │ │ ├── client_certificates.yaml │ │ │ ├── client_certificates_mandatory.yaml │ │ │ ├── client_certificates_optional.yaml │ │ │ ├── client_certificate.crt │ │ │ └── enforcer-truststore-opa-certs │ │ │ │ └── ca.pem │ │ ├── openAPIs │ │ │ ├── http2_secured_openAPI.yaml │ │ │ ├── http2_clear_text_openAPI.yaml │ │ │ ├── api_policy_invalid_param_id_openAPI.yaml │ │ │ ├── no_basepath_openAPI.yaml │ │ │ ├── all_http_methods_for_wildcard_openAPI.yaml │ │ │ └── api_key_blocked_openAPI.yaml │ │ ├── asyncAPIs │ │ │ ├── websocket_basic_asyncAPI.yaml │ │ │ ├── websocket_scope_asyncAPI.yaml │ │ │ ├── websocket_security_disabled_asyncAPI.yaml │ │ │ └── websocket_topic_asyncAPI.yaml │ │ └── apiYaml │ │ │ ├── default_version_v1.yaml │ │ │ └── default_version_v2.yaml │ │ └── java │ │ └── org │ │ └── wso2 │ │ └── choreo │ │ └── connect │ │ └── tests │ │ ├── apim │ │ └── dto │ │ │ └── Subscription.java │ │ └── context │ │ └── ChoreoConnect.java └── mock-backend-server │ └── src │ └── main │ └── resources │ ├── echo-service.pkcs12 │ ├── backendKeystore.pkcs12 │ ├── interceptorKeystore.pkcs12 │ ├── Dockerfile │ └── scripts │ └── file-creator-for-test-cases.sh ├── enforcer-parent └── enforcer │ ├── .gitignore │ └── src │ └── main │ ├── gen │ └── org │ │ └── wso2 │ │ └── choreo │ │ └── connect │ │ └── discovery │ │ ├── api │ │ ├── TimeoutConfigOrBuilder.java │ │ ├── MockedContentExampleOrBuilder.java │ │ ├── MockedHeaderConfigOrBuilder.java │ │ └── RetryConfigOrBuilder.java │ │ ├── config │ │ └── enforcer │ │ │ ├── SoapOrBuilder.java │ │ │ ├── RestServerOrBuilder.java │ │ │ ├── CacheOrBuilder.java │ │ │ ├── MetricsOrBuilder.java │ │ │ ├── ThreadPoolOrBuilder.java │ │ │ └── JWTUserOrBuilder.java │ │ ├── service │ │ └── health │ │ │ ├── HealthCheckRequestOrBuilder.java │ │ │ └── HealthCheckResponseOrBuilder.java │ │ └── keymgt │ │ └── RevokedTokenOrBuilder.java │ ├── resources │ └── applicationinsights.json │ └── java │ └── org │ └── wso2 │ └── choreo │ └── connect │ └── enforcer │ └── constants │ └── RouterAccessLogConstants.java ├── .gitmodules ├── performance └── benchmarks │ ├── cpus-1 │ └── images │ │ ├── diagram.png │ │ ├── percentile.png │ │ ├── throughput.png │ │ └── response_time_0ms.png │ ├── cpus-2 │ └── images │ │ ├── diagram.png │ │ ├── percentile.png │ │ ├── throughput.png │ │ └── response_time_0ms.png │ └── inteceptor │ └── images │ └── inteceptorDiagram.png ├── codecov.yml ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── config.yml │ └── task_form.yml ├── pull_request_template.md └── workflows │ └── coverage.yml ├── resources ├── adapter │ └── security │ │ └── truststore │ │ └── consul │ │ ├── local-dc-client-consul-0-key.pem │ │ └── local-dc-client-consul-0.pem ├── envoy.yaml └── license │ └── LICENSE-ROUTER.txt ├── api └── proto │ └── wso2 │ ├── discovery │ ├── ga │ │ └── api.proto │ ├── config │ │ └── enforcer │ │ │ ├── jwt_user.proto │ │ │ ├── cache.proto │ │ │ ├── tm_url_group.proto │ │ │ ├── rest_server.proto │ │ │ ├── management.proto │ │ │ ├── claim_mapping.proto │ │ │ ├── jms_connection_params.proto │ │ │ ├── thread_pool.proto │ │ │ ├── auth_header.proto │ │ │ ├── cert.proto │ │ │ ├── throttle_publisher_pool.proto │ │ │ ├── security.proto │ │ │ ├── service.proto │ │ │ ├── binary_publisher.proto │ │ │ ├── throttling.proto │ │ │ ├── jwt_issuer.proto │ │ │ ├── jwt_generator.proto │ │ │ └── throttle_agent.proto │ ├── subscription │ │ ├── api_list.proto │ │ ├── url_mapping.proto │ │ ├── application_list.proto │ │ ├── application_policy.proto │ │ ├── subscription_list.proto │ │ ├── application_policy_list.proto │ │ ├── subscription_policy_list.proto │ │ ├── application_key_mapping_list.proto │ │ ├── application.proto │ │ ├── application_key_mapping.proto │ │ ├── subscription.proto │ │ ├── api.proto │ │ └── subscription_policy.proto │ ├── keymgt │ │ └── key_manager_config.proto │ ├── api │ │ ├── security_info.proto │ │ └── endpoint_security.proto │ ├── throttle │ │ ├── blocking_conditions.proto │ │ └── throttle_data.proto │ └── service │ │ ├── subscription │ │ ├── sds.proto │ │ ├── apids.proto │ │ ├── appds.proto │ │ ├── app_policy_ds.proto │ │ ├── sub_policy_ds.proto │ │ └── app_key_mapping_ds.proto │ │ ├── api │ │ └── apids.proto │ │ ├── ga │ │ └── apids.proto │ │ ├── config │ │ └── cds.proto │ │ ├── keymgt │ │ └── kmds.proto │ │ └── throttle │ │ └── tdds.proto │ └── health │ └── service │ └── health.proto ├── adapter ├── internal │ ├── notifier │ │ └── types.go │ └── oasparser │ │ └── model │ │ └── mgw_swagger_dummy.go ├── test-resources │ └── envoycodegen │ │ └── asyncapi_websocket.yaml └── pkg │ └── metrics │ └── types.go └── .gitignore /.trivyignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /envoy-filters/.bazelversion: -------------------------------------------------------------------------------- 1 | ./envoy/.bazelversion -------------------------------------------------------------------------------- /envoy-filters/.bazelrc: -------------------------------------------------------------------------------- 1 | import %workspace%/envoy/.bazelrc 2 | -------------------------------------------------------------------------------- /samples/interceptors/.gitignore: -------------------------------------------------------------------------------- 1 | bookstore/ 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /.fossa.yml: -------------------------------------------------------------------------------- 1 | version: 3 2 | 3 | paths: 4 | exclude: 5 | - ./samples 6 | -------------------------------------------------------------------------------- /envoy-filters/bazel/get_workspace_status: -------------------------------------------------------------------------------- 1 | ../envoy/bazel/get_workspace_status -------------------------------------------------------------------------------- /envoy-filters/mgw-source/filters/http/mgw-wasm-websocket/.bazelversion : -------------------------------------------------------------------------------- 1 | 5.4.0 2 | -------------------------------------------------------------------------------- /samples/interceptors/golang/go-interceptor-server-generated/.gitignore: -------------------------------------------------------------------------------- 1 | certs/ 2 | -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/.swagger-codegen/VERSION: -------------------------------------------------------------------------------- 1 | 3.0.29 -------------------------------------------------------------------------------- /samples/interceptors/nodejs/nodejs-interceptor-server-generated/.gitignore: -------------------------------------------------------------------------------- 1 | certs/ 2 | -------------------------------------------------------------------------------- /samples/istio/service-to-service/microservices/schedules-service/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | -------------------------------------------------------------------------------- /Architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/Architecture.png -------------------------------------------------------------------------------- /samples/interceptors/golang/go-interceptor-server-generated/.swagger-codegen/VERSION: -------------------------------------------------------------------------------- 1 | 3.0.29 -------------------------------------------------------------------------------- /integration/test-integration/src/main/resources/project.properties: -------------------------------------------------------------------------------- 1 | version = ${project.version} -------------------------------------------------------------------------------- /samples/interceptors/nodejs/nodejs-interceptor-server-generated/.swagger-codegen/VERSION: -------------------------------------------------------------------------------- 1 | 3.0.29 -------------------------------------------------------------------------------- /samples/interceptors/ballerina/cc-sample-xml-interceptor/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | Dependencies.toml 3 | -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/.gitignore: -------------------------------------------------------------------------------- 1 | src/main/resources/interceptor.jks 2 | -------------------------------------------------------------------------------- /samples/interceptors/sample-backend/cc-sample-legacy-xml-backend/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | Dependencies.toml 3 | -------------------------------------------------------------------------------- /samples/istio/service-to-service/microservices/trains-service/.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | Dependencies.toml 3 | -------------------------------------------------------------------------------- /samples/interceptors/nodejs/nodejs-interceptor-server-generated/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apiToVhosts.json: -------------------------------------------------------------------------------- 1 | { 2 | "VHostAPI2": ["us.wso2.com"] 3 | } 4 | -------------------------------------------------------------------------------- /envoy-filters/mgw-api/extensions/filters/http/mgw-wasm-websocket/v3/WORKSPACE: -------------------------------------------------------------------------------- 1 | workspace(name = "mgw_wasm_websocket_api") -------------------------------------------------------------------------------- /enforcer-parent/enforcer/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .idea/ 3 | *.iml 4 | *.iws 5 | 6 | .DS_Store 7 | 8 | log/ 9 | target/ 10 | -------------------------------------------------------------------------------- /samples/interceptors/wso2-micro-integrator/InterceptorServiceWithMI/InterceptorServiceWithMIDockerExporter/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /samples/istio/mtls-mode/mtls.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/samples/istio/mtls-mode/mtls.jpg -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "envoy-filters/envoy"] 2 | path = envoy-filters/envoy 3 | url = https://github.com/envoyproxy/envoy.git 4 | -------------------------------------------------------------------------------- /samples/interceptors/wso2-micro-integrator/InterceptorServiceWithMI/InterceptorServiceWithMICompositeExporter/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /samples/istio/sidecar-mode/sidecar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/samples/istio/sidecar-mode/sidecar.jpg -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/2/apiToAsyncAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "WebSocketScopeAPI": "websocket_scope_asyncAPI.yaml" 3 | } 4 | -------------------------------------------------------------------------------- /samples/filters/basic-auth-filter/src/main/resources/META-INF/services/org.wso2.choreo.connect.enforcer.commons.Filter: -------------------------------------------------------------------------------- 1 | org.example.tests.BasicAuth 2 | -------------------------------------------------------------------------------- /samples/filters/sample-filter/src/main/resources/META-INF/services/org.wso2.choreo.connect.enforcer.commons.Filter: -------------------------------------------------------------------------------- 1 | org.example.tests.CustomFilter 2 | -------------------------------------------------------------------------------- /samples/interceptors/resources/interceptor.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/samples/interceptors/resources/interceptor.jks -------------------------------------------------------------------------------- /performance/benchmarks/cpus-1/images/diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/performance/benchmarks/cpus-1/images/diagram.png -------------------------------------------------------------------------------- /performance/benchmarks/cpus-2/images/diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/performance/benchmarks/cpus-2/images/diagram.png -------------------------------------------------------------------------------- /integration/test-integration/src/main/resources/META-INF/services/org.wso2.choreo.connect.enforcer.commons.Filter: -------------------------------------------------------------------------------- 1 | org.wso2.choreo.connect.tests.CustomFilter 2 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/rewriteResourcePath_v1.j2: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /performance/benchmarks/cpus-1/images/percentile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/performance/benchmarks/cpus-1/images/percentile.png -------------------------------------------------------------------------------- /performance/benchmarks/cpus-1/images/throughput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/performance/benchmarks/cpus-1/images/throughput.png -------------------------------------------------------------------------------- /performance/benchmarks/cpus-2/images/percentile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/performance/benchmarks/cpus-2/images/percentile.png -------------------------------------------------------------------------------- /performance/benchmarks/cpus-2/images/throughput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/performance/benchmarks/cpus-2/images/throughput.png -------------------------------------------------------------------------------- /samples/istio/service-to-service/east-west-traffic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/samples/istio/service-to-service/east-west-traffic.png -------------------------------------------------------------------------------- /performance/benchmarks/cpus-1/images/response_time_0ms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/performance/benchmarks/cpus-1/images/response_time_0ms.png -------------------------------------------------------------------------------- /performance/benchmarks/cpus-2/images/response_time_0ms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/performance/benchmarks/cpus-2/images/response_time_0ms.png -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/ccRemoveHeader_v1.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: REMOVE_HEADER 3 | parameters: 4 | headerName: {{ .headerName }} 5 | -------------------------------------------------------------------------------- /integration/test-integration/src/main/resources/META-INF/services/org.wso2.carbon.apimgt.common.gateway.jwttransformer.JWTTransformer: -------------------------------------------------------------------------------- 1 | org.wso2.choreo.connect.tests.CustomJWTTransformer 2 | -------------------------------------------------------------------------------- /performance/benchmarks/inteceptor/images/inteceptorDiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/performance/benchmarks/inteceptor/images/inteceptorDiagram.png -------------------------------------------------------------------------------- /integration/test-integration/src/main/resources/META-INF/services/org.wso2.choreo.connect.enforcer.commons.opa.OPARequestGenerator: -------------------------------------------------------------------------------- 1 | org.wso2.choreo.connect.tests.CustomOPARequestGenerator 2 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/configs/aws-lambda-config.toml: -------------------------------------------------------------------------------- 1 | [router.awsLambda] 2 | awsRegion = "us-east-1" 3 | payloadPassthrough = true 4 | invocationMode = "SYNCHRONOUS" 5 | -------------------------------------------------------------------------------- /samples/apiProjects/SampleSOAPApi/api_meta.yaml: -------------------------------------------------------------------------------- 1 | deploy: 2 | import: 3 | preserveProvider: true 4 | rotateRevision: false 5 | update: true 6 | name: SampleSOAPApi 7 | version: "1.0" 8 | -------------------------------------------------------------------------------- /integration/mock-backend-server/src/main/resources/echo-service.pkcs12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/mock-backend-server/src/main/resources/echo-service.pkcs12 -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/keystore/wso2carbon.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/test-integration/src/test/resources/keystore/wso2carbon.jks -------------------------------------------------------------------------------- /samples/apiProjects/SampleSOAPApi/deployment_environments.yaml: -------------------------------------------------------------------------------- 1 | type: deployment_environments 2 | version: v4.1.0 3 | data: 4 | - 5 | displayOnDevportal: true 6 | deploymentEnvironment: Default 7 | -------------------------------------------------------------------------------- /integration/mock-backend-server/src/main/resources/backendKeystore.pkcs12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/mock-backend-server/src/main/resources/backendKeystore.pkcs12 -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/database/WSO2AM_DB.mv.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/test-integration/src/test/resources/database/WSO2AM_DB.mv.db -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/database/WSO2MB_DB.mv.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/test-integration/src/test/resources/database/WSO2MB_DB.mv.db -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/database/WSO2CARBON_DB.mv.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/test-integration/src/test/resources/database/WSO2CARBON_DB.mv.db -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/database/WSO2SHARED_DB.mv.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/test-integration/src/test/resources/database/WSO2SHARED_DB.mv.db -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/git-artifacts/zip/petstore1/api_meta.yaml: -------------------------------------------------------------------------------- 1 | deploy: 2 | import: 3 | preserveProvider: true 4 | update: true 5 | name: SwaggerPetstore 6 | version: 1.0.6 7 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/keystore/client-keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/test-integration/src/test/resources/keystore/client-keystore.jks -------------------------------------------------------------------------------- /envoy-filters/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | AccessModifierOffset: -2 4 | ColumnLimit: 100 5 | DerivePointerAlignment: false 6 | PointerAlignment: Left 7 | SortIncludes: false 8 | ... 9 | 10 | -------------------------------------------------------------------------------- /integration/mock-backend-server/src/main/resources/interceptorKeystore.pkcs12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/mock-backend-server/src/main/resources/interceptorKeystore.pkcs12 -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/database/WSO2METRICS_DB.mv.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/test-integration/src/test/resources/database/WSO2METRICS_DB.mv.db -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/git-artifacts/directory/petstore/api_meta.yaml: -------------------------------------------------------------------------------- 1 | deploy: 2 | import: 3 | preserveProvider: true 4 | update: true 5 | name: SwaggerPetstore 6 | version: 1.0.6 7 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/keystore/client-truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/test-integration/src/test/resources/keystore/client-truststore.jks -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/ccAddHeader_v1.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: SET_HEADER 3 | parameters: 4 | headerName: {{ .headerName }} 5 | headerValue: {{ .headerValue }} 6 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | project: 4 | default: 5 | target: 27% 6 | threshold: 1% 7 | patch: 8 | default: 9 | target: 80% 10 | threshold: 1% 11 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/addQueryParam_v1.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: ADD_QUERY 3 | parameters: 4 | queryParamName: {{ .paramKey }} 5 | queryParamValue: {{ .paramValue }} 6 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/customAddHeader_v2.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: SET_HEADER 3 | parameters: 4 | headerName: customV2NewHeaderKey 5 | headerValue: {{ .customHeaderValue }} 6 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/keystore/invalid-client-keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/test-integration/src/test/resources/keystore/invalid-client-keystore.jks -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/customAddHeader_v1.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: SET_HEADER 3 | parameters: 4 | headerName: {{ .customHeaderName }} 5 | headerValue: {{ .customHeaderValue }} 6 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/dockerVolumeMounts/gitea/gitea/gitea.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/integration/test-integration/src/test/resources/dockerVolumeMounts/gitea/gitea/gitea.db -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/dockerVolumeMounts/opa-volume/policies/custom-policy.rego: -------------------------------------------------------------------------------- 1 | package custom 2 | 3 | default allow = false 4 | 5 | allow = true { 6 | input.headers["custom-foo"] == "custom-bar" 7 | } 8 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/git-artifacts/zip/petstore1/deployment_environments.yaml: -------------------------------------------------------------------------------- 1 | type: deployment_environments 2 | version: v4.0.0 3 | data: 4 | - 5 | displayOnDevportal: true 6 | deploymentEnvironment: Default 7 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/ccChangeHTTPMethod_v1.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: REWRITE_RESOURCE_METHOD 3 | parameters: 4 | currentMethod: {{ .currentMethod }} 5 | updatedMethod: {{ .updatedMethod }} 6 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/git-artifacts/directory/petstore/deployment_environments.yaml: -------------------------------------------------------------------------------- 1 | type: deployment_environments 2 | version: v4.0.0 3 | data: 4 | - 5 | displayOnDevportal: true 6 | deploymentEnvironment: Default 7 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/ccCallInterceptorService_v1.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: CALL_INTERCEPTOR_SERVICE 3 | parameters: 4 | interceptorServiceURL: {{ .interceptorServiceURL }} 5 | includes: {{ .includes }} 6 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policiesInvalid/ccAddHeaderNotSupportedParam_v1.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: SET_HEADER 3 | parameters: 4 | headerNameNotSupportedParam: {{ .headerName }} 5 | headerValue: {{ .headerValue }} 6 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policiesInvalid/ccAddHeaderNotSupportedAction_v1.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: SET_HEADER_NOT_SUPPORTED_ACTION 3 | parameters: 4 | headerName: {{ .headerName }} 5 | headerValue: {{ .headerValue }} 6 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/deploymentEnvironments/vhost2_deploy_env.yaml: -------------------------------------------------------------------------------- 1 | type: deployment_environments 2 | version: v4.0.0 3 | data: 4 | - displayOnDevportal: true 5 | deploymentVhost: us.wso2.com 6 | deploymentEnvironment: Default 7 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/deploymentEnvironments/vhost1_deploy_env.yaml: -------------------------------------------------------------------------------- 1 | type: deployment_environments 2 | version: v4.0.0 3 | data: 4 | - # set default vhost from configs: localhost 5 | displayOnDevportal: true 6 | deploymentEnvironment: Default 7 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apiToAsyncAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "WebSocketBasicAPI": "websocket_basic_asyncAPI.yaml", 3 | "WebSocketTopicAPI": "websocket_topic_asyncAPI.yaml", 4 | "WebSocketSecurityDisabledAPI": "websocket_security_disabled_asyncAPI.yaml" 5 | } 6 | -------------------------------------------------------------------------------- /samples/istio/README.md: -------------------------------------------------------------------------------- 1 | # Istio 2 | 3 | Choreo Connect can be integrated with Istio service mesh using the approaches listed below for applying API Management for microservices. 4 | 5 | - [MTLS Mode](mtls-mode) 6 | - [Sidecar Mode](sidecar-mode) 7 | - [Service to Service - East-West Traffic](service-to-service) 8 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Lines starting with '#' are comments. 2 | # Each line is a file pattern followed by one or more owners. 3 | 4 | # See: https://help.github.com/articles/about-codeowners/ 5 | 6 | # These owners will be the default owners for everything in the repo. 7 | * @pubudu538 @Krishanx92 @HeshanSudarshana 8 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/dockerCompose/backend-service.yaml: -------------------------------------------------------------------------------- 1 | - "5006:5006" 2 | mockBackend: 3 | image: wso2/choreo-connect-mock-backend:1.3.0-m1-SNAPSHOT 4 | ports: 5 | - "2383:2383" 6 | - "2399:2399" 7 | - "2340:2340" 8 | links: 9 | - router 10 | -------------------------------------------------------------------------------- /samples/interceptors/wso2-micro-integrator/InterceptorServiceWithMI/InterceptorServiceWithMIDockerExporter/Resources/wso2carbon.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/samples/interceptors/wso2-micro-integrator/InterceptorServiceWithMI/InterceptorServiceWithMIDockerExporter/Resources/wso2carbon.jks -------------------------------------------------------------------------------- /resources/adapter/security/truststore/consul/local-dc-client-consul-0-key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN EC PRIVATE KEY----- 2 | MHcCAQEEIPBO0X3kFQxjX1QPO58OzLPVG4to4tBHNorS2SWiLyN1oAoGCCqGSM49 3 | AwEHoUQDQgAEcGIvW4re6oK257dTWj5/9X4k+Ca7yLHOKghQUcz5XnFpWDLeT0qf 4 | 4Eop6HLgaDpvWPInOrWsoXCXNFAQy2S9ZQ== 5 | -----END EC PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/rewriteResourcePath_v1.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: REWRITE_RESOURCE_PATH 3 | parameters: 4 | resourcePath: {{ .newResourcePath }} 5 | {{- if isParamExists . "includeQueryParams" }} 6 | includeQueryParams: {{ .includeQueryParams }} 7 | {{- end }} 8 | -------------------------------------------------------------------------------- /samples/interceptors/wso2-micro-integrator/InterceptorServiceWithMI/InterceptorServiceWithMIDockerExporter/Resources/client-truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/samples/interceptors/wso2-micro-integrator/InterceptorServiceWithMI/InterceptorServiceWithMIDockerExporter/Resources/client-truststore.jks -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apiToOpenAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "JwtScopeAPI": "scopes_openAPI.yaml", 3 | "APIKeyTestAPI": "api_key_openAPI.yaml", 4 | "APIKeyBlockedAPI": "api_key_blocked_openAPI.yaml", 5 | "Http2ClearTextAPI": "http2_clear_text_openAPI.yaml", 6 | "Http2SecuredAPI": "http2_secured_openAPI.yaml" 7 | } 8 | -------------------------------------------------------------------------------- /samples/interceptors/wso2-micro-integrator/InterceptorServiceWithMI/InterceptorServiceWithMIDockerExporter/CompositeApps/InterceptorServiceWithMICompositeExporter-1.0.0.car: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wso2/product-microgateway/HEAD/samples/interceptors/wso2-micro-integrator/InterceptorServiceWithMI/InterceptorServiceWithMIDockerExporter/CompositeApps/InterceptorServiceWithMICompositeExporter-1.0.0.car -------------------------------------------------------------------------------- /samples/rest-to-soap-conversion/PhoneVerification/README.md: -------------------------------------------------------------------------------- 1 | ## Sample REST to SOAP conversion 2 | 3 | This is an example for how to perform REST to SOAP conversion using WSO2 Micro Integrator. To learn more details on this please head over to [Choreo Connect documentation](https://apim.docs.wso2.com/en/latest/deploy-and-publish/deploy-on-gateway/choreo-connect/deploy-api/deploy-rest-to-soap-api/). 4 | -------------------------------------------------------------------------------- /envoy-filters/BUILD: -------------------------------------------------------------------------------- 1 | package(default_visibility = ["//visibility:public"]) 2 | 3 | load( 4 | "@envoy//bazel:envoy_build_system.bzl", 5 | "envoy_cc_binary", 6 | ) 7 | 8 | envoy_cc_binary( 9 | name = "envoy", 10 | repository = "@envoy", 11 | deps = [ 12 | "//mgw-source/filters/http/mgw:config", 13 | "@envoy//source/exe:envoy_main_entry_lib", 14 | ], 15 | ) 16 | -------------------------------------------------------------------------------- /samples/rest-to-soap-conversion/PhoneVerification/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhoneVerification 4 | 5 | 6 | 7 | 8 | 9 | 10 | org.wso2.developerstudio.eclipse.mavenmultimodule.project.nature 11 | 12 | 13 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/certs/client_certificates.yaml: -------------------------------------------------------------------------------- 1 | type: client_certificates 2 | version: v4.0.0 3 | data: 4 | - 5 | alias: client_certificate 6 | certificate: client_certificate.crt 7 | tierName: Gold 8 | apiIdentifier: 9 | providerName: admin 10 | apiName: MutualSSL 11 | version: 1.0.5 12 | uuid: db038e80-34d9-4503-b590-e12ad216f562 13 | id: 0 14 | -------------------------------------------------------------------------------- /samples/rest-to-soap-conversion/PhoneVerification/PhoneVerificationConfigs/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhoneVerificationConfigs 4 | 5 | 6 | 7 | 8 | 9 | 10 | org.wso2.developerstudio.eclipse.esb.project.nature 11 | 12 | 13 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/certs/client_certificates_mandatory.yaml: -------------------------------------------------------------------------------- 1 | type: client_certificates 2 | version: v4.0.0 3 | data: 4 | - 5 | alias: client_certificate 6 | certificate: client_certificate.crt 7 | tierName: Gold 8 | apiIdentifier: 9 | providerName: admin 10 | apiName: MutualSSLMandatory 11 | version: 3.0.0 12 | uuid: db038e80-34d9-4503-b590-e12ad216f563 13 | id: 0 14 | -------------------------------------------------------------------------------- /samples/interceptors/golang/go-interceptor-server-generated/go/model_dynamic_endpoint.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Choreo-Connect Interceptor Service 3 | * 4 | * Interceptor Service 5 | * 6 | * API version: v1 7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) 8 | */ 9 | package swagger 10 | 11 | type DynamicEndpoint struct { 12 | EndpointName string `json:"endpointName,omitempty"` 13 | } 14 | -------------------------------------------------------------------------------- /samples/rest-to-soap-conversion/PhoneVerification/PhoneVerificationConfigs/src/main/resources/metadata/PhoneVerify_metadata.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | key: "PhoneVerify-1.0.0" 3 | name: "PhoneVerify" 4 | displayName: "PhoneVerify" 5 | description: "Sample API" 6 | version: "1.0.0" 7 | serviceUrl: "http://172.17.0.1:8290/phoneverify" 8 | definitionType: "OAS3" 9 | securityType: "BASIC" 10 | mutualSSLEnabled: false 11 | apiId: "null" 12 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/certs/client_certificates_optional.yaml: -------------------------------------------------------------------------------- 1 | type: client_certificates 2 | version: v4.0.0 3 | data: 4 | - 5 | alias: client_certificate 6 | certificate: client_certificate.crt 7 | tierName: Unlimited 8 | apiIdentifier: 9 | providerName: admin 10 | apiName: MutualSSLOptional 11 | version: 2.0.0 12 | uuid: db038e80-34d9-4503-b590-e12ad216f564 13 | id: 0 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: '📚 Documentation Issue' 4 | about: Report an issue if something is missing or incorrect in the official documentation. 5 | url: https://github.com/wso2/docs-apim/issues/new/choose 6 | - name: '💬 Discord' 7 | url: 'https://discord.com/invite/Xa5VubmThw' 8 | about: | 9 | Chat with the community to get quick clarifications for your questions. -------------------------------------------------------------------------------- /envoy-filters/mgw-source/filters/http/mgw-wasm-websocket/BUILD: -------------------------------------------------------------------------------- 1 | load("@proxy_wasm_cpp_sdk//bazel:defs.bzl", "proxy_wasm_cc_binary") 2 | 3 | proxy_wasm_cc_binary( 4 | name = "mgw-websocket.wasm", 5 | srcs = ["filter.cc", "filter.h", "handler_impl.h", "handler_impl.cc", "handler.h"], 6 | deps = [ 7 | "@mgw_wasm_websocket_api//:api_cc_proto", 8 | "@proxy_wasm_cpp_sdk//:proxy_wasm_intrinsics_full" 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /samples/rest-to-soap-conversion/PhoneVerification/PhoneVerificationCompositeExporter/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | PhoneVerificationCompositeExporter 4 | 5 | 6 | 7 | 8 | 9 | 10 | org.wso2.developerstudio.eclipse.distribution.project.nature 11 | 12 | 13 | -------------------------------------------------------------------------------- /samples/interceptors/wso2-micro-integrator/InterceptorServiceWithMI/InterceptorServiceWithMIConfigs/artifact.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | src/main/synapse-config/api/Choreo-Connect_Interceptor_Service.xml 4 | 5 | 6 | -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/src/main/java/io/swagger/api/ApiException.java: -------------------------------------------------------------------------------- 1 | package io.swagger.api; 2 | 3 | @javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2021-11-04T06:10:22.979Z[GMT]") 4 | public class ApiException extends Exception { 5 | private int code; 6 | public ApiException (int code, String msg) { 7 | super(msg); 8 | this.code = code; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/openAPI-definitions/http2_sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: 3.0.0 3 | info: 4 | description: API Definition for http2 backend 5 | title: http2 secured backend 6 | version: v1 7 | paths: 8 | /hello: 9 | get: 10 | responses: 11 | "200": 12 | description: successful operation 13 | x-wso2-basePath: /http2_secured 14 | x-wso2-http2-backend-enabled: true 15 | x-wso2-production-endpoints: 16 | urls: 17 | - https://mockBackend:2351 18 | -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/src/main/java/io/swagger/api/NotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.swagger.api; 2 | 3 | @javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2021-11-04T06:10:22.979Z[GMT]") 4 | public class NotFoundException extends ApiException { 5 | private int code; 6 | public NotFoundException (int code, String msg) { 7 | super(code, msg); 8 | this.code = code; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /envoy-filters/mgw-api/extensions/filters/http/mgw-wasm-websocket/v3/config.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package envoy.extensions.filters.http.mgw_wasm_websocket.v3; 4 | 5 | import "google/protobuf/duration.proto"; 6 | 7 | // this proto represents configuration for the example filter 8 | message Config { 9 | string node_id = 1; 10 | 11 | string rate_limit_service = 2; 12 | 13 | google.protobuf.Duration timeout = 3; 14 | 15 | bool failure_mode_deny = 4; 16 | } -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/dockerCompose/backend-service-gql.yaml: -------------------------------------------------------------------------------- 1 | - "5006:5006" 2 | mockBackend: 3 | image: wso2/choreo-connect-mock-backend:1.3.0-m1-SNAPSHOT 4 | command: java -cp "lib/*" org.wso2.choreo.connect.mockbackend.MockServices -tls-enabled -gql-enabled 5 | ports: 6 | - "2370:2370" 7 | - "2371:2371" #Added this port for test debug purposes 8 | - "2383:2383" 9 | - "2399:2399" 10 | links: 11 | - router 12 | -------------------------------------------------------------------------------- /samples/interceptors/wso2-micro-integrator/InterceptorServiceWithMI/InterceptorServiceWithMIDockerExporter/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE 2 | FROM ${BASE_IMAGE} 3 | COPY CompositeApps/*.car ${WSO2_SERVER_HOME}/repository/deployment/server/carbonapps/ 4 | COPY Resources/wso2carbon.jks ${WSO2_SERVER_HOME}/repository/resources/security/wso2carbon.jks 5 | COPY Resources/client-truststore.jks ${WSO2_SERVER_HOME}/repository/resources/security/client-truststore.jks 6 | #COPY Libs/*.jar ${WSO2_SERVER_HOME}/lib/ 7 | 8 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/openAPIs/http2_secured_openAPI.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | description: API Definition for http2 backend 4 | title: http2 secured backend 5 | version: v1 6 | paths: 7 | /hello: 8 | get: 9 | responses: 10 | "200": 11 | description: successful operation 12 | x-wso2-basePath: /http2_secured 13 | x-wso2-http2-backend-enabled: true 14 | x-wso2-production-endpoints: 15 | urls: 16 | - https://mockBackend:2351 17 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/dockerCompose/git-service.yaml: -------------------------------------------------------------------------------- 1 | 2 | gitea: 3 | image: gitea/gitea:1.17.1 4 | hostname: gitea 5 | environment: 6 | - USER_UID=1000 7 | - USER_GID=1000 8 | - LOCAL_ROOT_URL=http://gitea/ 9 | - ROOT_URL=http://gitea/ 10 | restart: always 11 | volumes: 12 | - ./gitea/gitea/gitea.db:/data/gitea/gitea.db 13 | - ./gitea/gitea/conf/app.ini:/data/gitea/conf/app.ini 14 | ports: 15 | - "8285:8285" 16 | 17 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/openAPIs/http2_clear_text_openAPI.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | info: 3 | description: API Definition for http2 backend 4 | title: http2 clear text backend 5 | version: v1 6 | paths: 7 | /hello: 8 | get: 9 | responses: 10 | "200": 11 | description: successful operation 12 | x-wso2-basePath: /http2_clear_text 13 | x-wso2-http2-backend-enabled: true 14 | x-wso2-production-endpoints: 15 | urls: 16 | - http://mockBackend2:2350 17 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/admin/throttle/advanced/5ReqPerMin.json: -------------------------------------------------------------------------------- 1 | { 2 | "policyName": "5ReqPerMin", 3 | "displayName": "5ReqPerMin", 4 | "description": "Allows 5 requests (if http or else events if ws) per minute", 5 | "isDeployed": false, 6 | "type": "AdvancedThrottlePolicy", 7 | "defaultLimit": { 8 | "type": "REQUESTCOUNTLIMIT", 9 | "requestCount": { 10 | "timeUnit": "min", 11 | "unitTime": 2, 12 | "requestCount": 5 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/interceptors/wso2-micro-integrator/InterceptorServiceWithMI/InterceptorServiceWithMIDockerExporter/deployment.toml: -------------------------------------------------------------------------------- 1 | [server] 2 | hostname = "localhost" 3 | hot_deployment = false 4 | 5 | [user_store] 6 | type = "read_only_ldap" 7 | 8 | [keystore.tls] 9 | file_name = "wso2carbon.jks" 10 | password = "wso2carbon" 11 | alias = "interceptor" 12 | key_password = "wso2carbon" 13 | 14 | [truststore] 15 | file_name = "client-truststore.jks" 16 | password = "wso2carbon" 17 | alias = "mg" 18 | algorithm = "AES" 19 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/admin/throttle/application/5ReqPerMin.json: -------------------------------------------------------------------------------- 1 | { 2 | "policyName": "5ReqPerMin", 3 | "displayName": "5ReqPerMin", 4 | "description": "Allows 5 requests (if http or else events if ws) per minute", 5 | "isDeployed": false, 6 | "type": "ApplicationThrottlePolicy", 7 | "defaultLimit": { 8 | "type": "REQUESTCOUNTLIMIT", 9 | "requestCount": { 10 | "timeUnit": "min", 11 | "unitTime": 2, 12 | "requestCount": 5 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/deploymentEnvironments/apictl_test_deploy_multiple_env.yaml: -------------------------------------------------------------------------------- 1 | type: deployment_environments 2 | version: v4.0.0 3 | data: 4 | - displayOnDevportal: true 5 | deploymentEnvironment: US 6 | - displayOnDevportal: true 7 | deploymentVhost: localhost 8 | deploymentEnvironment: US 9 | - displayOnDevportal: true 10 | deploymentEnvironment: Default 11 | - displayOnDevportal: true 12 | deploymentVhost: eu.wso2.com 13 | deploymentEnvironment: Default 14 | -------------------------------------------------------------------------------- /samples/interceptors/nodejs/nodejs-interceptor-server-generated/controllers/Request.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('../utils/writer.js'); 4 | var Request = require('../service/RequestService'); 5 | 6 | module.exports.handleRequest = function handleRequest (req, res, next, body) { 7 | Request.handleRequest(body) 8 | .then(function (response) { 9 | utils.writeJson(res, response); 10 | }) 11 | .catch(function (response) { 12 | utils.writeJson(res, response); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/ga/api.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.ga; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/ga;ga"; 6 | option java_package = "org.wso2.choreo.connect.discovery.ga"; 7 | option java_outer_classname = "GAApiProto"; 8 | option java_multiple_files = false; 9 | 10 | // [#protodoc-title: Api] 11 | 12 | // API config model 13 | message Api { 14 | string apiUUID = 1; 15 | string revisionUUID = 2; 16 | string organizationUUID = 3; 17 | } 18 | -------------------------------------------------------------------------------- /samples/interceptors/nodejs/nodejs-interceptor-server-generated/controllers/Response.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('../utils/writer.js'); 4 | var Response = require('../service/ResponseService'); 5 | 6 | module.exports.handleResponse = function handleResponse (req, res, next, body) { 7 | Response.handleResponse(body) 8 | .then(function (response) { 9 | utils.writeJson(res, response); 10 | }) 11 | .catch(function (response) { 12 | utils.writeJson(res, response); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/Http1API.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Http1API", 3 | "version": "1.0.0", 4 | "context": "http1_api", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/pet/findByStatus", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2383/v2" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/asyncAPIs/websocket_basic_asyncAPI.yaml: -------------------------------------------------------------------------------- 1 | asyncapi: 2.0.0 2 | info: 3 | title: WebSocketBasicAPI 4 | version: '1.0.0' 5 | servers: 6 | production: 7 | url: 'ws://mockBackend:2360/v2' 8 | protocol: ws 9 | channels: 10 | /*: 11 | publish: {} 12 | components: 13 | securitySchemes: 14 | oauth2: 15 | type: oauth2 16 | flows: 17 | implicit: 18 | authorizationUrl: 'http://localhost:9999' 19 | scopes: {} 20 | x-scopes-bindings: {} 21 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/BlockedAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BlockedAPI", 3 | "version": "1.0.0", 4 | "context": "blocked", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/pet/findByStatus", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2383/v2" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/Http2SecuredAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Http2SecuredAPI", 3 | "version": "1.0.0", 4 | "context": "http2_secured", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/hello", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "https://mockBackend:2351" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/JwtScopeAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JwtScopeAPI", 3 | "version": "1.0.0", 4 | "context": "jwt_scope", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/pet/findByStatus", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2383/v2" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/VHostAPI2.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "VHostAPI2", 3 | "version": "1.0.0", 4 | "context": "vhostApi2", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/pet/findByStatus", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2390/v2" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/Http2ClearTextAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Http2ClearTextAPI", 3 | "version": "1.0.0", 4 | "context": "http2_clear_text", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/hello", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend2:2350" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/interceptors/golang/go-interceptor-server-generated/go/model_invocation_context_authentication_context.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Choreo-Connect Interceptor Service 3 | * 4 | * Interceptor Service 5 | * 6 | * API version: v1 7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) 8 | */ 9 | package swagger 10 | 11 | type InvocationContextAuthenticationContext struct { 12 | TokenType string `json:"tokenType,omitempty"` 13 | 14 | Token string `json:"token,omitempty"` 15 | 16 | KeyType string `json:"keyType,omitempty"` 17 | } 18 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/jwt_user.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "JWTUserProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: JWTUser] 11 | 12 | // JWT User model 13 | message JWTUser { 14 | 15 | string username = 1; 16 | 17 | string password = 2; 18 | } 19 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/deploymentEnvironments/apictl_test_deploy_env.yaml: -------------------------------------------------------------------------------- 1 | type: deployment_environments 2 | version: v4.0.0 3 | data: 4 | - # set default vhost from configs: localhost 5 | displayOnDevportal: true 6 | deploymentEnvironment: Default 7 | - # use vhost defined here 8 | displayOnDevportal: true 9 | deploymentVhost: us.wso2.com 10 | deploymentEnvironment: Default 11 | - # use vhost defined here 12 | displayOnDevportal: true 13 | deploymentVhost: eu.wso2.com 14 | deploymentEnvironment: Default 15 | -------------------------------------------------------------------------------- /resources/envoy.yaml: -------------------------------------------------------------------------------- 1 | admin: 2 | access_log: [] 3 | address: 4 | socket_address: 5 | address: 0.0.0.0 6 | port_value: 9000 7 | layered_runtime: 8 | layers: 9 | - name: deprecation 10 | static_layer: 11 | re2.max_program_size.error_level: 1000 12 | # This value is added to overcome the warning log, and it is not based on any experiment. 13 | - name: globalMaxConnections 14 | static_layer: 15 | overload.global_downstream_max_connections: 2147483647 16 | node: 17 | cluster: default_cluster 18 | id: default 19 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/AdvancedThrottlingAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AdvancedThrottlingAPI", 3 | "version": "1.0.0", 4 | "context": "advanced_throttling", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/pet/findByStatus", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2383/v2" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/api_list.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | import "wso2/discovery/subscription/api.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 9 | option java_outer_classname = "APIListProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: APIList] 13 | 14 | // APIList data model 15 | message APIList { 16 | repeated APIs list = 2; 17 | } 18 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/SubscriptionValidationAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SubscriptionValidationAPI", 3 | "version": "1.0.0", 4 | "context": "subs_validation", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/pet/findByStatus", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2383/v2" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/src/main/java/io/swagger/configuration/HomeController.java: -------------------------------------------------------------------------------- 1 | package io.swagger.configuration; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | /** 7 | * Home redirection to swagger api documentation 8 | */ 9 | @Controller 10 | public class HomeController { 11 | @RequestMapping(value = "/") 12 | public String index() { 13 | System.out.println("/swagger-ui/index.html"); 14 | return "redirect:/swagger-ui/"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/ApplicationThrottlingAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ApplicationThrottlingAPI", 3 | "version": "1.0.0", 4 | "context": "application_throttling", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/pet/findByStatus", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2383/v2" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/2/apis/KeyTemplateThrottlingAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "KeyTemplateThrottlingAPI", 3 | "version": "1.0.0", 4 | "context": "keytemplate_throttling", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/pet/findByStatus", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2383/v2" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/interceptors/nodejs/nodejs-interceptor-server-generated/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "choreo-connect-interceptor-service", 3 | "version": "1.0.0", 4 | "description": "Interceptor Service", 5 | "main": "index.js", 6 | "scripts": { 7 | "prestart": "npm install", 8 | "start": "node index.js" 9 | }, 10 | "keywords": [ 11 | "swagger" 12 | ], 13 | "license": "Unlicense", 14 | "private": true, 15 | "dependencies": { 16 | "connect": "^3.2.0", 17 | "js-yaml": "^3.3.0", 18 | "oas3-tools": "^2.2.3", 19 | "xml-js": "^1.6.11" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/cache.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "CacheProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: Cache] 11 | 12 | // JWT Generator model 13 | message Cache { 14 | bool enable = 1; 15 | 16 | int32 maximumSize = 2; 17 | 18 | sint32 expiryTime = 3; 19 | } 20 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/tm_url_group.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "TMURLGroupProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: TMURLGroup] 11 | 12 | message TMURLGroup { 13 | repeated string receiverURLs = 1; 14 | repeated string authURLs = 2; 15 | string type = 3; 16 | } 17 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/keymgt/key_manager_config.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.keymgt; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/keymgt;keymgt"; 6 | option java_package = "org.wso2.choreo.connect.discovery.keymgt"; 7 | option java_outer_classname = "KeyManagerConfigProto"; 8 | option java_multiple_files = true; 9 | 10 | 11 | // KeyManagerConfig model 12 | message KeyManagerConfig { 13 | string name = 1; 14 | string type = 2; 15 | bool enabled = 3; 16 | string tenantDomain = 4; 17 | string configuration = 5; 18 | } 19 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/EndpointWithTrailingSlashAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "EndpointWithTrailingSlashAPI", 3 | "version": "1.0.0", 4 | "context": "endpointWithTrailingSlash", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/pet/findByStatus", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2390/v2" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/rest_server.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "RestServerProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: SSL] 11 | 12 | // Model for enable/ disable enforcer admin rest api 13 | message RestServer { 14 | // Enable outbound auth header 15 | bool enable = 1; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/APIKeyTestAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "APIKeyTestAPI", 3 | "version": "1.0.0", 4 | "context": "apiKey", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "securityScheme": ["oauth_basic_auth_api_key_mandatory", "api_key"], 8 | "operationsDTOS": [ 9 | { 10 | "verb": "GET", 11 | "target": "/dummy", 12 | "throttlingPolicy": "Unlimited" 13 | } 14 | ], 15 | "endpoint": { 16 | "endpoint_type": "http", 17 | "production_endpoints": { 18 | "url": "http://mockBackend:2383/v2" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/admin/throttle/subscription/5EventsPerMin.json: -------------------------------------------------------------------------------- 1 | { 2 | "policyName": "5EventsPerMin", 3 | "displayName": "5EventsPerMin", 4 | "description": "Allows 5 events per minute", 5 | "isDeployed": false, 6 | "type": "SubscriptionThrottlePolicy", 7 | "defaultLimit": { 8 | "type": "EVENTCOUNTLIMIT", 9 | "eventCount": { 10 | "timeUnit": "min", 11 | "unitTime": 1, 12 | "eventCount": 5 13 | } 14 | }, 15 | "stopOnQuotaReach":true, 16 | "rateLimitCount": 1000, 17 | "subscriberCount": 50, 18 | "billingPlan": "FREE" 19 | } 20 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/dockerVolumeMounts/opa-volume/policies/sample-policy.rego: -------------------------------------------------------------------------------- 1 | package sample 2 | 3 | default allow = false 4 | 5 | allow = true { 6 | input.transportHeaders.foo == "bar" 7 | input.method == "POST" 8 | input.authenticationContext.keyType == "PRODUCTION" 9 | input.authenticationContext.tokenType == "JWT" 10 | input.apiContext.vhost == "localhost" 11 | input.apiContext.orgId == "carbon.super" 12 | } 13 | 14 | envoy_headers[headerKey] { 15 | some headerKey 16 | input.transportHeaders[headerKey] 17 | startswith(headerKey, ":") 18 | } 19 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/api/security_info.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.api; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/api;api"; 6 | option java_package = "org.wso2.choreo.connect.discovery.api"; 7 | option java_outer_classname = "SecurityInfoProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: Endpoint] 11 | 12 | // Endpoint config model 13 | message SecurityInfo { 14 | string password = 1; 15 | map customParameters = 2; 16 | string securityType = 3; 17 | bool enabled = 4; 18 | string username = 5; 19 | } 20 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/url_mapping.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 6 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 7 | option java_outer_classname = "URLMappingProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: URLMapping] 11 | 12 | // URLMapping data model 13 | message URLMapping { 14 | string authScheme = 1; 15 | string httpMethod = 2; 16 | string urlPattern = 3; 17 | repeated string scopes = 4; 18 | } 19 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/APIKeyBlockedAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "APIKeyBlockedAPI", 3 | "version": "1.0.0", 4 | "context": "apiKey_blocked_api", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "securityScheme": ["oauth_basic_auth_api_key_mandatory", "api_key"], 8 | "operationsDTOS": [ 9 | { 10 | "verb": "GET", 11 | "target": "/dummy", 12 | "throttlingPolicy": "Unlimited" 13 | } 14 | ], 15 | "endpoint": { 16 | "endpoint_type": "http", 17 | "production_endpoints": { 18 | "url": "http://mockBackend:2383/v2" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/2/apis/GraphQLScopeAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "GraphQLScopeAPI", 3 | "version": "1.0.0", 4 | "context": "gqlScope", 5 | "type": "GRAPHQL", 6 | "description": "This GraphQL API is used to cover scope related test cases relevant to the GraphQL APIs.", 7 | "tiersCollection": "Unlimited", 8 | "operationsDTOS": [], 9 | "endpoint": { 10 | "endpoint_type": "http", 11 | "production_endpoints": { 12 | "url": "http://mockBackend:2320/gql" 13 | }, 14 | "sandbox_endpoints": { 15 | "url": "http://mockBackend:2320/gql" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/apiProjects/SampleGraphQLApi/Definitions/schema.graphql: -------------------------------------------------------------------------------- 1 | # The query type, represents all of the entry points into the GraphQL API 2 | type Query { 3 | hello: String 4 | hero: [Hero] 5 | address: [Address] 6 | } 7 | 8 | # The mutation type, represents all updates to the data 9 | type Mutation { 10 | createHero(name: String, age: Int): Hero 11 | } 12 | 13 | # Represents Address details 14 | type Address{ 15 | planet: String 16 | village: String 17 | } 18 | 19 | # Represents hero details 20 | type Hero{ 21 | id: ID 22 | name: String 23 | age: Int 24 | location: Address 25 | } 26 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/api/endpoint_security.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.api; 4 | 5 | import "wso2/discovery/api/security_info.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/api;api"; 8 | option java_package = "org.wso2.choreo.connect.discovery.api"; 9 | option java_outer_classname = "EndpointSecurityProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: Endpoint] 13 | 14 | // Endpoint config model 15 | message EndpointSecurity { 16 | SecurityInfo SandBoxSecurityInfo = 1; 17 | SecurityInfo ProductionSecurityInfo = 2; 18 | } 19 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/2/apis/SoapAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SoapAPI", 3 | "version": "1.0.0", 4 | "context": "soap", 5 | "type": "SOAP", 6 | "tiersCollection": "Unlimited", 7 | "wsdlInfo": { 8 | "type": "WSDL" 9 | }, 10 | "wsdlUrl": "wsdl/PhoneVerification.wsdl", 11 | "operationsDTOS": [ 12 | { 13 | "verb": "POST", 14 | "target": "/phoneverify", 15 | "throttlingPolicy": "Unlimited" 16 | } 17 | ], 18 | "endpoint": { 19 | "endpoint_type": "http", 20 | "production_endpoints": { 21 | "url": "http://mockBackend:2340" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/application_list.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | import "wso2/discovery/subscription/application.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 9 | option java_outer_classname = "ApplicationListProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: ApplicationList] 13 | 14 | // ApplicationList data model 15 | message ApplicationList { 16 | repeated Application list = 2; 17 | } 18 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/TimeoutConfigOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/discovery/api/endpoint_cluster.proto 3 | 4 | package org.wso2.choreo.connect.discovery.api; 5 | 6 | public interface TimeoutConfigOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:wso2.discovery.api.TimeoutConfig) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * uint32 routeTimeoutInMillis = 1; 12 | * @return The routeTimeoutInMillis. 13 | */ 14 | int getRouteTimeoutInMillis(); 15 | } 16 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/2/apis/GraphQLThrottlingAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "GraphQLThrottlingAPI", 3 | "version": "1.0.0", 4 | "context": "gqlThrottling", 5 | "type": "GRAPHQL", 6 | "description": "This GraphQL API is used to cover throttling test cases relevant to the GraphQL APIs.", 7 | "tiersCollection": "Unlimited", 8 | "operationsDTOS": [], 9 | "endpoint": { 10 | "endpoint_type": "http", 11 | "production_endpoints": { 12 | "url": "http://mockBackend:2320/gql" 13 | }, 14 | "sandbox_endpoints": { 15 | "url": "http://mockBackend:2320/gql" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/management.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "ManagementProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: SSL] 11 | 12 | // Model for enforcer management user 13 | message Management { 14 | // Admin user name 15 | string username = 1; 16 | 17 | // Admin user password 18 | string password = 2; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/application_policy.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 6 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 7 | option java_outer_classname = "ApplicationPolicyProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: ApplicationPolicy] 11 | 12 | // ApplicationPolicy data model 13 | message ApplicationPolicy { 14 | int32 id = 1; 15 | int32 tenantId = 2; 16 | string name = 3; 17 | string quotaType = 4; 18 | } 19 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/subscription_list.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | import "wso2/discovery/subscription/subscription.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 9 | option java_outer_classname = "SubscriptionListProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: SubscriptionList] 13 | 14 | // SubscriptionList data model 15 | message SubscriptionList { 16 | repeated Subscription list = 2; 17 | } 18 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/WebSocketBasicAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WebSocketBasicAPI", 3 | "version": "1.0.0", 4 | "context": "websocket-basic", 5 | "type": "WS", 6 | "description": "This WS API later gets updated with an AsyncAPI definition which includes the actual topics/resources.", 7 | "tiersCollection": "AsyncUnlimited", 8 | "operationsDTOS": [], 9 | "endpoint": { 10 | "endpoint_type": "ws", 11 | "production_endpoints": { 12 | "url": "ws://mockBackend:2360/v2" 13 | }, 14 | "sandbox_endpoints": { 15 | "url": "ws://mockBackend:2360/v2" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/WebSocketTopicAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WebSocketTopicAPI", 3 | "version": "1.0.0", 4 | "context": "websocket-topic", 5 | "type": "WS", 6 | "description": "This WS API later gets updated with an AsyncAPI definition which includes the actual topics/resources.", 7 | "tiersCollection": "AsyncUnlimited", 8 | "operationsDTOS": [], 9 | "endpoint": { 10 | "endpoint_type": "ws", 11 | "production_endpoints": { 12 | "url": "ws://mockBackend:2360/v2" 13 | }, 14 | "sandbox_endpoints": { 15 | "url": "ws://mockBackend:2360/v2" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/claim_mapping.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "ClaimMappingProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: ClaimMapping] 11 | 12 | // Claim mapping model 13 | message ClaimMapping { 14 | 15 | // Remote claim 16 | string remoteClaim = 1; 17 | 18 | // Local claim 19 | string localClaim = 2; 20 | } 21 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/config/enforcer/SoapOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/discovery/config/enforcer/soap.proto 3 | 4 | package org.wso2.choreo.connect.discovery.config.enforcer; 5 | 6 | public interface SoapOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:wso2.discovery.config.enforcer.Soap) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * bool soapErrorInXMLEnabled = 1; 12 | * @return The soapErrorInXMLEnabled. 13 | */ 14 | boolean getSoapErrorInXMLEnabled(); 15 | } 16 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/dockerCompose/apim-in-common-network-docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | networks: 3 | apim_and_cc: 4 | name: apim_and_cc 5 | services: 6 | apim: 7 | image: wso2/wso2am:4.2.0 8 | user: root 9 | ports: 10 | - "9764:9764" 11 | - "9444:9444" 12 | - "5673:5673" 13 | environment: 14 | - PROFILE_NAME=control-plane 15 | volumes: 16 | - ./conf/deployment.toml:/home/wso2carbon/wso2-config-volume/repository/conf/deployment.toml 17 | - ./database:/home/wso2carbon/wso2am-4.2.0/repository/database:rw 18 | networks: 19 | - apim_and_cc 20 | 21 | -------------------------------------------------------------------------------- /samples/apiProjects/SampleSOAPApi/api.yaml: -------------------------------------------------------------------------------- 1 | type: api 2 | version: v4.1.0 3 | data: 4 | name: SampleSOAPApi 5 | context: /soap 6 | version: "1.0.0" 7 | provider: admin 8 | lifeCycleStatus: CREATED 9 | isRevision: false 10 | revisionId: 0 11 | type: SOAP 12 | transport: 13 | - http 14 | - https 15 | policies: 16 | - Unlimited 17 | visibility: PUBLIC 18 | endpointConfig: 19 | endpoint_type: http 20 | production_endpoints: 21 | url: http://mockBackend:2340 22 | sandbox_endpoints: 23 | url: http://mockBackend:2340 24 | endpointImplementationType: ENDPOINT 25 | websubSubscriptionConfiguration: null 26 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/EnvoyHttpFilterAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "EnvoyHttpFilterAPI", 3 | "version": "1.0.0", 4 | "context": "envoy_http_filter_api", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/headers", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2383/v2" 18 | }, 19 | "sandbox_endpoints": { 20 | "url": "http://mockBackend:2383/v2" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/asyncAPIs/websocket_scope_asyncAPI.yaml: -------------------------------------------------------------------------------- 1 | asyncapi: 2.0.0 2 | info: 3 | title: WebSocketScopeAPI 4 | version: 1.0.0 5 | servers: 6 | production: 7 | url: 'ws://mockBackend:2360/v2' 8 | protocol: ws 9 | channels: 10 | /*: 11 | subscribe: 12 | x-scopes: 13 | - reader 14 | x-auth-type: Any 15 | components: 16 | securitySchemes: 17 | oauth2: 18 | type: oauth2 19 | flows: 20 | implicit: 21 | authorizationUrl: 'http://localhost:9999' 22 | scopes: 23 | reader: '' 24 | x-scopes-bindings: 25 | reader: '' 26 | -------------------------------------------------------------------------------- /envoy-filters/mgw-api/extensions/filters/http/mgw-wasm-websocket/v3/BUILD: -------------------------------------------------------------------------------- 1 | load("@rules_proto//proto:defs.bzl", "proto_library") 2 | 3 | 4 | proto_library( 5 | name = "api_proto", 6 | srcs = ["service.proto","config.proto"], 7 | visibility = ["//visibility:public"], 8 | deps = [ 9 | #"@proxy_wasm_cpp_sdk//:proxy_wasm_intrinsics_proto" 10 | "@com_google_protobuf//:duration_proto" 11 | #"@proxy_wasm_cpp_sdk//:proxy_wasm_intrinsics_lite_proto" 12 | 13 | ] 14 | ) 15 | 16 | cc_proto_library( 17 | name = "api_cc_proto", 18 | deps = [ 19 | ":api_proto" 20 | ], 21 | visibility = ["//visibility:public"], 22 | ) -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/APIKeyAppLevelThrottleAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "APIKeyAppLevelThrottleAPI", 3 | "version": "1.0.0", 4 | "context": "apikey_app_level_throttling", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "securityScheme": ["oauth_basic_auth_api_key_mandatory", "api_key"], 8 | "operationsDTOS": [ 9 | { 10 | "verb": "GET", 11 | "target": "/pet/findByStatus", 12 | "throttlingPolicy": "Unlimited" 13 | } 14 | ], 15 | "endpoint": { 16 | "endpoint_type": "http", 17 | "production_endpoints": { 18 | "url": "http://mockBackend:2383/v2" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/jms_connection_params.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "JMSConnectionParamsProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: JMSConnectionParams] 11 | 12 | // JMS connection parameter model 13 | message JmsConnectionParameters { 14 | // Event listening endpoints of JMS connection 15 | repeated string eventListeningEndpoints = 1; 16 | } 17 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apiYaml/default_version_v1.yaml: -------------------------------------------------------------------------------- 1 | type: api 2 | version: v4.0.0 3 | data: 4 | name: DefaultVersion 5 | context: /defaultVersion/1.0.0 6 | version: 1.0.0 7 | provider: admin 8 | lifeCycleStatus: PUBLISHED 9 | isDefaultVersion: false 10 | isRevision: false 11 | revisionId: 0 12 | type: HTTP 13 | transport: 14 | - http 15 | - https 16 | policies: 17 | - Unlimited 18 | visibility: PUBLIC 19 | endpointConfig: 20 | endpoint_type: http 21 | production_endpoints: 22 | url: http://mockBackend:2383/v2 23 | endpointImplementationType: ENDPOINT 24 | websubSubscriptionConfiguration: null 25 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apiYaml/default_version_v2.yaml: -------------------------------------------------------------------------------- 1 | type: api 2 | version: v4.0.0 3 | data: 4 | name: DefaultVersion 5 | context: /defaultVersion/2.0.0 6 | version: 2.0.0 7 | provider: admin 8 | lifeCycleStatus: PUBLISHED 9 | isDefaultVersion: true 10 | isRevision: false 11 | revisionId: 0 12 | type: HTTP 13 | transport: 14 | - http 15 | - https 16 | policies: 17 | - Unlimited 18 | visibility: PUBLIC 19 | endpointConfig: 20 | endpoint_type: http 21 | production_endpoints: 22 | url: http://mockBackend:2383/v2 23 | endpointImplementationType: ENDPOINT 24 | websubSubscriptionConfiguration: null 25 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/VHostAPI1.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "VHostAPI1", 3 | "version": "1.0.0", 4 | "context": "vhostApi1", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/pet/findByStatus", 11 | "throttlingPolicy": "Unlimited" 12 | }, 13 | { 14 | "verb": "GET", 15 | "target": "/store/inventory", 16 | "throttlingPolicy": "Unlimited" 17 | } 18 | ], 19 | "endpoint": { 20 | "endpoint_type": "http", 21 | "production_endpoints": { 22 | "url": "http://mockBackend:2383/v2" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/WebSocketSecurityDisabledAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WebSocketSecurityDisabledAPI", 3 | "version": "1.0.0", 4 | "context": "websocket-security-disabled", 5 | "type": "WS", 6 | "description": "This WS API later gets updated with an AsyncAPI definition which includes the actual topics/resources.", 7 | "tiersCollection": "AsyncUnlimited", 8 | "operationsDTOS": [], 9 | "endpoint": { 10 | "endpoint_type": "ws", 11 | "production_endpoints": { 12 | "url": "ws://mockBackend:2360/v2" 13 | }, 14 | "sandbox_endpoints": { 15 | "url": "ws://mockBackend:2360/v2" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/application_policy_list.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | import "wso2/discovery/subscription/application_policy.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 9 | option java_outer_classname = "ApplicationPolicyListProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: ApplicationPolicyList] 13 | 14 | // ApplicationPolicyList data model 15 | message ApplicationPolicyList { 16 | repeated ApplicationPolicy list = 2; 17 | } 18 | -------------------------------------------------------------------------------- /samples/interceptors/golang/go-interceptor-server-generated/go/model_request_handler_request_body.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Choreo-Connect Interceptor Service 3 | * 4 | * Interceptor Service 5 | * 6 | * API version: v1 7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) 8 | */ 9 | package swagger 10 | 11 | type RequestHandlerRequestBody struct { 12 | RequestHeaders *map[string]string `json:"requestHeaders,omitempty"` 13 | 14 | RequestTrailers *map[string]string `json:"requestTrailers,omitempty"` 15 | 16 | RequestBody string `json:"requestBody,omitempty"` 17 | 18 | InvocationContext *InvocationContext `json:"invocationContext,omitempty"` 19 | } 20 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/subscription_policy_list.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | import "wso2/discovery/subscription/subscription_policy.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 9 | option java_outer_classname = "SubscriptionPolicyListProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: SubscriptionPolicyList] 13 | 14 | // SubscriptionPolicyList data model 15 | message SubscriptionPolicyList { 16 | repeated SubscriptionPolicy list = 2; 17 | } 18 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/2/apis/CompressionTestAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CompressionTestAPI", 3 | "version": "1.0.0", 4 | "context": "compressionTestAPI", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "POST", 10 | "target": "/echo-gzip", 11 | "throttlingPolicy": "Unlimited" 12 | }, 13 | { 14 | "verb": "POST", 15 | "target": "/echo", 16 | "throttlingPolicy": "Unlimited" 17 | } 18 | ], 19 | "endpoint": { 20 | "endpoint_type": "http", 21 | "production_endpoints": { 22 | "url": "http://mockBackend:2383/v2" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/2/apis/GraphQLAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "GraphQLBasicAPI", 3 | "version": "1.0.0", 4 | "context": "gql", 5 | "type": "GRAPHQL", 6 | "description": "This GraphQL API is used to cover basic test cases relevant to the GraphQL.", 7 | "tiersCollection": "Unlimited", 8 | "securityScheme": ["oauth2", "oauth_basic_auth_api_key_mandatory", "api_key"], 9 | "operationsDTOS": [], 10 | "endpoint": { 11 | "endpoint_type": "http", 12 | "production_endpoints": { 13 | "url": "http://mockBackend:2320/gql" 14 | }, 15 | "sandbox_endpoints": { 16 | "url": "http://mockBackend:2320/gql" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/throttle/blocking_conditions.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.throttle; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/throttle;throttle"; 6 | option java_package = "org.wso2.choreo.connect.discovery.throttle"; 7 | option java_outer_classname = "BlockingConditionsProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: IPCondition] 11 | 12 | // IP blocking condition model 13 | message IPCondition { 14 | string type = 1; 15 | int32 id = 2; 16 | string fixedIp = 3; 17 | string startingIp = 4; 18 | string endingIp = 5; 19 | bool invert = 6; 20 | string tenantDomain = 7; 21 | } 22 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/thread_pool.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "ThreadPoolProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: ThreadPool] 11 | 12 | // ThreadPool model 13 | message ThreadPool { 14 | int32 coreSize = 1; 15 | 16 | int32 maxSize = 2; 17 | 18 | // keep alive time of threads in seconds 19 | int32 keepAliveTime = 3; 20 | 21 | int32 queueSize = 4; 22 | } 23 | -------------------------------------------------------------------------------- /envoy-filters/WORKSPACE: -------------------------------------------------------------------------------- 1 | workspace(name = "envoy_filter_example") 2 | 3 | local_repository( 4 | name = "envoy", 5 | path = "envoy", 6 | ) 7 | 8 | load("@envoy//bazel:api_binding.bzl", "envoy_api_binding") 9 | 10 | envoy_api_binding() 11 | 12 | load("@envoy//bazel:api_repositories.bzl", "envoy_api_dependencies") 13 | 14 | envoy_api_dependencies() 15 | 16 | load("@envoy//bazel:repositories.bzl", "envoy_dependencies") 17 | 18 | envoy_dependencies() 19 | 20 | load("@envoy//bazel:repositories_extra.bzl", "envoy_dependencies_extra") 21 | 22 | envoy_dependencies_extra() 23 | 24 | load("@envoy//bazel:dependency_imports.bzl", "envoy_dependency_imports") 25 | 26 | envoy_dependency_imports() 27 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/openAPIs/api_policy_invalid_param_id_openAPI.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.0" 2 | info: 3 | version: v1.0 4 | title: API-Policy API invalid param ID 5 | license: 6 | name: Apache 2.0 7 | url: 'http://www.apache.org/licenses/LICENSE-2.0.html' 8 | servers: 9 | - url: http://mockBackend:2383/v2 10 | x-wso2-basePath: /api-policy-invalid-param-id 11 | paths: 12 | /echo-full/rewrite-policy-with-capture-groups-invalid-param/shops/{shopId}/pets/{petId}/orders: 13 | get: 14 | summary: rewrite based policies appied with capture groups with invalid params 15 | responses: 16 | '200': 17 | description: successful operation 18 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/throttle/throttle_data.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.throttle; 4 | 5 | import "wso2/discovery/throttle/blocking_conditions.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/throttle;throttle"; 8 | option java_package = "org.wso2.choreo.connect.discovery.throttle"; 9 | option java_outer_classname = "ThrottleDataProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: ThrottleData] 13 | 14 | // Throttle Data model 15 | message ThrottleData { 16 | repeated string key_templates = 1; 17 | repeated string blocking_conditions = 2; 18 | repeated IPCondition ip_blocking_conditions = 3; 19 | } 20 | -------------------------------------------------------------------------------- /envoy-filters/.circleci/config.yml: -------------------------------------------------------------------------------- 1 | references: 2 | envoy-build-image: &envoy-build-image 3 | envoyproxy/envoy-build:latest 4 | 5 | version: 2 6 | jobs: 7 | build: 8 | docker: 9 | - image: *envoy-build-image 10 | resource_class: xlarge 11 | steps: 12 | - checkout 13 | - run: git submodule update --init 14 | - run: ./ci/do_ci.sh build 15 | test: 16 | docker: 17 | - image: *envoy-build-image 18 | resource_class: xlarge 19 | steps: 20 | - checkout 21 | - run: git submodule update --init 22 | - run: ./ci/do_ci.sh test 23 | 24 | workflows: 25 | version: 2 26 | all: 27 | jobs: 28 | - build 29 | - test 30 | 31 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/application_key_mapping_list.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | import "wso2/discovery/subscription/application_key_mapping.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 9 | option java_outer_classname = "ApplicationKeyMappingListProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: ApplicationKeyMappingList] 13 | 14 | // ApplicationKeyMappingList data model 15 | message ApplicationKeyMappingList { 16 | repeated ApplicationKeyMapping list = 2; 17 | } 18 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/config/enforcer/RestServerOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/discovery/config/enforcer/rest_server.proto 3 | 4 | package org.wso2.choreo.connect.discovery.config.enforcer; 5 | 6 | public interface RestServerOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:wso2.discovery.config.enforcer.RestServer) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | *
12 |    * Enable outbound auth header
13 |    * 
14 | * 15 | * bool enable = 1; 16 | * @return The enable. 17 | */ 18 | boolean getEnable(); 19 | } 20 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/2/apis/WebSocketTimeoutAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WebSocketTimeoutAPI", 3 | "version": "1.0.0", 4 | "context": "websocket-timeout", 5 | "type": "WS", 6 | "tiersCollection": "AsyncUnlimited", 7 | "description": "This has no special configs for timeout. Timeout is applied via gateway configs.", 8 | "operationsDTOS": [ 9 | { 10 | "verb": "SUBSCRIBE", 11 | "target": "/*" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "ws", 16 | "production_endpoints": { 17 | "url": "ws://mockBackend:2360/v2" 18 | }, 19 | "sandbox_endpoints": { 20 | "url": "ws://mockBackend:2360/v2" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /samples/istio/sidecar-mode/openAPI.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: HttpbinAPI 4 | version: v1.0.0 5 | servers: 6 | - 7 | url: http://httpbin 8 | security: 9 | - 10 | default: [] 11 | paths: 12 | /get: 13 | get: 14 | parameters: [] 15 | responses: 16 | "200": 17 | description: ok 18 | /anything: 19 | get: 20 | parameters: [] 21 | responses: 22 | "200": 23 | description: ok 24 | components: 25 | securitySchemes: 26 | default: 27 | type: oauth2 28 | flows: 29 | implicit: 30 | authorizationUrl: https://test.com 31 | scopes: {} 32 | x-wso2-basePath: /httpbin/api/v1.0.0 33 | 34 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/asyncAPIs/websocket_security_disabled_asyncAPI.yaml: -------------------------------------------------------------------------------- 1 | asyncapi: 2.0.0 2 | info: 3 | title: WebSocketBasicAPI 4 | version: '1.0.0' 5 | servers: 6 | production: 7 | url: 'ws://mockBackend:2360/v2' 8 | protocol: ws 9 | channels: 10 | /security-disabled-via-apim-publisher: 11 | publish: {} 12 | x-auth-type: None 13 | /security-disabled-via-extension: 14 | publish: {} 15 | x-wso2-disable-security: true 16 | components: 17 | securitySchemes: 18 | oauth2: 19 | type: oauth2 20 | flows: 21 | implicit: 22 | authorizationUrl: 'http://localhost:9999' 23 | scopes: {} 24 | x-scopes-bindings: {} 25 | -------------------------------------------------------------------------------- /samples/interceptors/nodejs/nodejs-interceptor-server-generated/README.md: -------------------------------------------------------------------------------- 1 | # Swagger generated server 2 | 3 | ## Overview 4 | This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. 5 | 6 | ### Running the server 7 | To run the server, run: 8 | 9 | ``` 10 | npm start 11 | ``` 12 | 13 | To view the Swagger UI interface: 14 | 15 | ``` 16 | open http://localhost:9081/docs 17 | ``` 18 | 19 | This project leverages the mega-awesome [swagger-tools](https://github.com/apigee-127/swagger-tools) middleware which does most all the work. 20 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/addQueryParam_v1.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /samples/interceptors/golang/go-interceptor-server-generated/go/logger.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Choreo-Connect Interceptor Service 3 | * 4 | * Interceptor Service 5 | * 6 | * API version: v1 7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) 8 | */ 9 | package swagger 10 | 11 | import ( 12 | "log" 13 | "net/http" 14 | "time" 15 | ) 16 | 17 | func Logger(inner http.Handler, name string) http.Handler { 18 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 19 | start := time.Now() 20 | 21 | inner.ServeHTTP(w, r) 22 | 23 | log.Printf( 24 | "%s %s %s %s", 25 | r.Method, 26 | r.RequestURI, 27 | name, 28 | time.Since(start), 29 | ) 30 | }) 31 | } 32 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/auth_header.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "AuthHeaderProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: SSL] 11 | 12 | // Listener and client certificate store model 13 | message AuthHeader { 14 | // Enable outbound auth header 15 | bool enableOutboundAuthHeader = 1; 16 | 17 | // Auth header name 18 | string authorizationHeader = 2; 19 | 20 | string testConsoleHeaderName = 3; 21 | } 22 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/java/org/wso2/choreo/connect/tests/apim/dto/Subscription.java: -------------------------------------------------------------------------------- 1 | package org.wso2.choreo.connect.tests.apim.dto; 2 | 3 | public class Subscription { 4 | private final String apiName; 5 | private final String appName; 6 | private final String tier; 7 | 8 | public Subscription(String apiName, String appName, String tier) { 9 | this.apiName = apiName; 10 | this.appName = appName; 11 | this.tier = tier; 12 | } 13 | 14 | public String getApiName() { 15 | return apiName; 16 | } 17 | 18 | public String getAppName() { 19 | return appName; 20 | } 21 | 22 | public String getTier() { 23 | return tier; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Purpose 2 | 3 | 4 | ### Issues 5 | 6 | Fixes # 7 | 8 | ### Automation tests 9 | - Unit tests added: Yes/No 10 | - Integration tests added: Yes/No 11 | 12 | ### Tested environments 13 | 14 | Not Tested 15 | 16 | --- 17 | #### Maintainers: Check before merge 18 | - [ ] Assigned 'Type' label 19 | - [ ] Assigned the project 20 | - [ ] Validated respective github issues 21 | - [ ] Assigned milestone to the github issue(s) 22 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/admin/throttle/advanced/3KbPerMin.json: -------------------------------------------------------------------------------- 1 | { 2 | "policyName": "3KbPerMin", 3 | "displayName": "3KbPerMin", 4 | "description": "Allows 3Kb per minute", 5 | "isDeployed": false, 6 | "type": "AdvancedThrottlePolicy", 7 | "defaultLimit": { 8 | "type": "BANDWIDTHLIMIT", 9 | "requestCount": { 10 | "timeUnit": "min", 11 | "unitTime": 1, 12 | "requestCount": 1000 13 | }, 14 | "bandwidth": { 15 | "timeUnit": "min", 16 | "unitTime": 2, 17 | "dataAmount": 3, 18 | "dataUnit": "KB" 19 | }, 20 | "eventCount": { 21 | "timeUnit": "min", 22 | "unitTime": 1, 23 | "eventCount": 1000 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/customAddHeader_v2.yaml: -------------------------------------------------------------------------------- 1 | type: operation_policy_specification 2 | version: v4.1.0 3 | data: 4 | category: Mediation 5 | name: customAddHeader 6 | version: v2 7 | displayName: Custom Add Header 8 | description: This policy allows you to add a new header to the request 9 | applicableFlows: 10 | - request 11 | supportedGateways: 12 | - ChoreoConnect 13 | supportedApiTypes: 14 | - HTTP 15 | policyAttributes: 16 | - 17 | name: customHeaderValue 18 | displayName: Header Value 19 | description: Value of the header 20 | validationRegex: "^([a-zA-Z\\d_][a-zA-Z\\d_\\-\\ ]*)$" 21 | type: String 22 | allowedValues: [] 23 | required: true 24 | -------------------------------------------------------------------------------- /adapter/internal/notifier/types.go: -------------------------------------------------------------------------------- 1 | package notifier 2 | 3 | // DeployedAPIRevision represents Information of deployed API revision data 4 | type DeployedAPIRevision struct { 5 | APIID string `json:"apiId"` 6 | RevisionID int `json:"revisionId"` 7 | EnvInfo []DeployedEnvInfo `json:"envInfo"` 8 | } 9 | 10 | // DeployedEnvInfo represents env Information of deployed API revision 11 | type DeployedEnvInfo struct { 12 | Name string `json:"name"` 13 | VHost string `json:"vhost"` 14 | } 15 | 16 | // UnDeployedAPIRevision info 17 | type UnDeployedAPIRevision struct { 18 | APIUUID string `json:"apiUUID"` 19 | RevisionUUID string `json:"revisionUUID"` 20 | Environment string `json:"environment"` 21 | } 22 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/admin/throttle/application/3KbPerMin.json: -------------------------------------------------------------------------------- 1 | { 2 | "policyName": "3KbPerMin", 3 | "displayName": "3KbPerMin", 4 | "description": "Allows 3Kb per minute", 5 | "isDeployed": false, 6 | "type": "ApplicationThrottlePolicy", 7 | "defaultLimit": { 8 | "type": "BANDWIDTHLIMIT", 9 | "requestCount": { 10 | "timeUnit": "min", 11 | "unitTime": 1, 12 | "requestCount": 1000 13 | }, 14 | "bandwidth": { 15 | "timeUnit": "min", 16 | "unitTime": 2, 17 | "dataAmount": 3, 18 | "dataUnit": "KB" 19 | }, 20 | "eventCount": { 21 | "timeUnit": "min", 22 | "unitTime": 1, 23 | "eventCount": 1000 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/2/apis/WebSocketScopeAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WebSocketScopeAPI", 3 | "version": "1.0.0", 4 | "context": "websocket-scope", 5 | "type": "WS", 6 | "tiersCollection": "AsyncUnlimited", 7 | "description": "The scope here for 'subscribe' will not be added until updated again with the AsyncAPI", 8 | "operationsDTOS": [ 9 | { 10 | "verb": "SUBSCRIBE", 11 | "target": "/*", 12 | "scopes": ["reader"] 13 | } 14 | ], 15 | "endpoint": { 16 | "endpoint_type": "ws", 17 | "production_endpoints": { 18 | "url": "ws://mockBackend:2360/v2" 19 | }, 20 | "sandbox_endpoints": { 21 | "url": "ws://mockBackend:2360/v2" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /samples/apiProjects/SampleWebsocketApi/Definitions/asyncapi.yaml: -------------------------------------------------------------------------------- 1 | asyncapi: 2.0.0 2 | info: 3 | title: WebSocket 4 | version: 1.0.0 5 | servers: 6 | production: 7 | url: ws://ws.ifelse.io:80 8 | protocol: ws 9 | channels: 10 | /notifications: 11 | publish: 12 | x-uri-mapping: /notifications 13 | subscribe: 14 | x-uri-mapping: /notifications 15 | x-scopes: 16 | "0": creator 17 | x-auth-type: Any 18 | components: 19 | securitySchemes: 20 | oauth2: 21 | type: oauth2 22 | flows: 23 | implicit: 24 | authorizationUrl: http://localhost:9999 25 | scopes: 26 | creator: creator 27 | x-scopes-bindings: 28 | creator: admin 29 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/service/subscription/sds.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discovery.service.subscription; 4 | 5 | import "envoy/service/discovery/v3/discovery.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.service.subscription"; 9 | option java_outer_classname = "SdsProto"; 10 | option java_multiple_files = true; 11 | option java_generic_services = true; 12 | 13 | // [#protodoc-title: SDS] 14 | service SubscriptionDiscoveryService { 15 | rpc StreamSubscriptions(stream envoy.service.discovery.v3.DiscoveryRequest) 16 | returns (stream envoy.service.discovery.v3.DiscoveryResponse) { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/istio/mtls-mode/openAPI.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: HttpbinAPI 4 | version: v1.0.0 5 | servers: 6 | - 7 | url: https://istio-ingressgateway.istio-system/httpbin/v1.0.0 8 | security: 9 | - 10 | default: [] 11 | paths: 12 | /get: 13 | get: 14 | parameters: [] 15 | responses: 16 | "200": 17 | description: ok 18 | /anything: 19 | get: 20 | parameters: [] 21 | responses: 22 | "200": 23 | description: ok 24 | components: 25 | securitySchemes: 26 | default: 27 | type: oauth2 28 | flows: 29 | implicit: 30 | authorizationUrl: https://test.com 31 | scopes: {} 32 | x-wso2-basePath: /httpbin/api/v1.0.0 33 | 34 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/service/subscription/apids.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discovery.service.subscription; 4 | 5 | import "envoy/service/discovery/v3/discovery.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.service.subscription"; 9 | option java_outer_classname = "ApiListDSProto"; 10 | option java_multiple_files = true; 11 | option java_generic_services = true; 12 | 13 | // [#protodoc-title: ApiListDS] 14 | service ApiListDiscoveryService { 15 | rpc StreamApiList(stream envoy.service.discovery.v3.DiscoveryRequest) 16 | returns (stream envoy.service.discovery.v3.DiscoveryResponse) { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/service/subscription/appds.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discovery.service.subscription; 4 | 5 | import "envoy/service/discovery/v3/discovery.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.service.subscription"; 9 | option java_outer_classname = "AppDSProto"; 10 | option java_multiple_files = true; 11 | option java_generic_services = true; 12 | 13 | // [#protodoc-title: AppDS] 14 | service ApplicationDiscoveryService { 15 | rpc StreamApplications(stream envoy.service.discovery.v3.DiscoveryRequest) 16 | returns (stream envoy.service.discovery.v3.DiscoveryResponse) { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/git-artifacts/zip/petstore1/api.yaml: -------------------------------------------------------------------------------- 1 | type: api 2 | version: v4.0.0 3 | data: 4 | name: SwaggerPetstoreZip 5 | description: 'This is a sample server Petstore server.' 6 | context: /zip 7 | version: 1.0.6 8 | provider: admin 9 | lifeCycleStatus: CREATED 10 | isRevision: false 11 | revisionId: 0 12 | type: HTTP 13 | transport: 14 | - http 15 | - https 16 | policies: 17 | - Unlimited 18 | visibility: PUBLIC 19 | endpointConfig: 20 | endpoint_type: http 21 | production_endpoints: 22 | url: http://localhost:8080 23 | sandbox_endpoints: 24 | url: http://localhost:8081 25 | endpointImplementationType: ENDPOINT 26 | websubSubscriptionConfiguration: null 27 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/ccRemoveHeader_v1.yaml: -------------------------------------------------------------------------------- 1 | type: operation_policy_specification 2 | version: v4.1.0 3 | data: 4 | category: Mediation 5 | name: ccRemoveHeader 6 | version: v1 7 | displayName: Remove Header 8 | description: This policy allows you to remove a header from the request 9 | applicableFlows: 10 | - request 11 | - response 12 | supportedGateways: 13 | - ChoreoConnect 14 | supportedApiTypes: 15 | - HTTP 16 | policyAttributes: 17 | - 18 | name: headerName 19 | displayName: Header Name 20 | description: Name of the header to be removed 21 | validationRegex: "^([a-zA-Z_][a-zA-Z\\d_\\-\\ ]*)$" 22 | type: String 23 | allowedValues: [] 24 | required: true 25 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/ExistingAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ExistingAPI", 3 | "version": "1.0.0", 4 | "context": "existing_api", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/pet/findByStatus", 11 | "throttlingPolicy": "Unlimited" 12 | }, 13 | { 14 | "verb": "GET", 15 | "target": "/headers", 16 | "throttlingPolicy": "Unlimited" 17 | } 18 | ], 19 | "endpoint": { 20 | "endpoint_type": "http", 21 | "production_endpoints": { 22 | "url": "http://mockBackend:2383/v2" 23 | }, 24 | "sandbox_endpoints": { 25 | "url": "http://mockBackend:2383/v2" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/cert.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "CertStoreProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: SSL] 11 | 12 | // Listener and client certificate store model 13 | message CertStore { 14 | // Path to the certificate store. Ex: keystore jks 15 | string location = 1; 16 | 17 | // Certificate store type 18 | // Ex: jks 19 | string type = 2; 20 | 21 | // Certificate store password 22 | string password = 3; 23 | } 24 | -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/src/main/java/io/swagger/RFC3339DateFormat.java: -------------------------------------------------------------------------------- 1 | package io.swagger; 2 | 3 | import com.fasterxml.jackson.databind.util.ISO8601DateFormat; 4 | import com.fasterxml.jackson.databind.util.ISO8601Utils; 5 | 6 | import java.text.FieldPosition; 7 | import java.util.Date; 8 | 9 | 10 | public class RFC3339DateFormat extends ISO8601DateFormat { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | // Same as ISO8601DateFormat but serializing milliseconds. 15 | @Override 16 | public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { 17 | String value = ISO8601Utils.format(date, true); 18 | toAppendTo.append(value); 19 | return toAppendTo; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /.github/workflows/coverage.yml: -------------------------------------------------------------------------------- 1 | name: Test Coverage Uploader 2 | 3 | on: 4 | push: 5 | branches: 6 | - envoy-gw 7 | workflow_dispatch: 8 | branches: 9 | - envoy-gw 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Set up Go 1.x 15 | uses: actions/setup-go@v2 16 | with: 17 | go-version: ^1.13 18 | - name: Checkout envoy-gw 19 | uses: actions/checkout@v2 20 | - name: Set up JDK 11 21 | uses: actions/setup-java@v1 22 | with: 23 | java-version: 11 24 | - name: Build with Tests 25 | run: mvn clean install --file pom.xml 26 | - name: Upload unit test coverage to Codecov 27 | uses: codecov/codecov-action@v1.2.1 28 | with: 29 | flags: unit_tests 30 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/service/subscription/app_policy_ds.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discovery.service.subscription; 4 | 5 | import "envoy/service/discovery/v3/discovery.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.service.subscription"; 9 | option java_outer_classname = "AppPolicyDSProto"; 10 | option java_multiple_files = true; 11 | option java_generic_services = true; 12 | 13 | // [#protodoc-title: AppPolicyDS] 14 | service ApplicationPolicyDiscoveryService { 15 | rpc StreamApplicationPolicies(stream envoy.service.discovery.v3.DiscoveryRequest) 16 | returns (stream envoy.service.discovery.v3.DiscoveryResponse) { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/service/subscription/sub_policy_ds.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discovery.service.subscription; 4 | 5 | import "envoy/service/discovery/v3/discovery.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.service.subscription"; 9 | option java_outer_classname = "SubPolicyDSProto"; 10 | option java_multiple_files = true; 11 | option java_generic_services = true; 12 | 13 | // [#protodoc-title: SubPolicyDS] 14 | service SubscriptionPolicyDiscoveryService { 15 | rpc StreamSubscriptionPolicies(stream envoy.service.discovery.v3.DiscoveryRequest) 16 | returns (stream envoy.service.discovery.v3.DiscoveryResponse) { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/configs/mtls-enabled-config.toml: -------------------------------------------------------------------------------- 1 | [router.downstream.tls] 2 | mTLSAPIsEnabled = true 3 | 4 | # For API key without APIM 5 | [[enforcer.security.tokenService]] 6 | name = "Resident Key Manager" 7 | issuer = "https://localhost:9443/oauth2/token" 8 | certificateAlias = "wso2carbon" 9 | jwksURL = "" 10 | validateSubscription = false 11 | consumerKeyClaim = "azp" 12 | certificateFilePath = "/home/wso2/security/truststore/wso2carbon.pem" 13 | 14 | [[enforcer.security.tokenService]] 15 | name = "APIM Publisher" 16 | issuer = "https://localhost:9443/publisher" 17 | validateSubscription = false # set this to false when using API key without APIM 18 | certificateAlias = "" 19 | certificateFilePath = "/home/wso2/security/truststore/wso2carbon.pem" 20 | -------------------------------------------------------------------------------- /samples/interceptors/ballerina/cc-sample-xml-interceptor/Ballerina.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [build-options] 16 | observabilityIncluded = false 17 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/resources/applicationinsights.json: -------------------------------------------------------------------------------- 1 | { 2 | "connectionString": "", 3 | "role": { 4 | "name": "choreo_connect_enforcer" 5 | }, 6 | "sampling": { 7 | "percentage": 50 8 | }, 9 | "heartbeat": { 10 | "intervalSeconds": 900 11 | }, 12 | "preview": { 13 | "instrumentation": { 14 | "azureSdk": { 15 | "enabled": false 16 | } 17 | }, 18 | "metricIntervalSeconds": 60 19 | }, 20 | "instrumentation": { 21 | "logging": { 22 | "level": "OFF" 23 | }, 24 | "cassandra": { 25 | "enabled": false 26 | }, 27 | "jdbc": { 28 | "enabled": false 29 | }, 30 | "jms": { 31 | "enabled": false 32 | }, 33 | "kafka": { 34 | "enabled": false 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/WebsocketApiLevelBandwidthThrottleAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WebsocketApiLevelBandwidthThrottleAPI", 3 | "version": "1.0.0", 4 | "context": "websocket-api-level-bandwidth-throttle", 5 | "description": "This API will later get updated to include the API throttling policy.", 6 | "type": "WS", 7 | "tiersCollection": "AsyncUnlimited", 8 | "operationsDTOS": [ 9 | { 10 | "verb": "SUBSCRIBE", 11 | "target": "/*", 12 | "throttlingPolicy": "Unlimited" 13 | } 14 | ], 15 | "endpoint": { 16 | "endpoint_type": "ws", 17 | "production_endpoints": { 18 | "url": "ws://mockBackend:2360/v2" 19 | }, 20 | "sandbox_endpoints": { 21 | "url": "ws://mockBackend:2360/v2" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/throttle_publisher_pool.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "PublisherPoolProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: PublisherPool] 11 | 12 | // Throttle Publisher pool configuration model 13 | message PublisherPool { 14 | int32 maxIdleDataPublishingAgents = 1; 15 | int32 initIdleObjectDataPublishingAgents = 2; 16 | int32 publisherThreadPoolCoreSize = 3; 17 | int32 publisherThreadPoolMaximumSize = 4; 18 | int32 publisherThreadPoolKeepAliveTime = 5; 19 | } 20 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/service/health/HealthCheckRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/health/service/health.proto 3 | 4 | package org.wso2.choreo.connect.discovery.service.health; 5 | 6 | public interface HealthCheckRequestOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:grpc.health.v1.HealthCheckRequest) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * string service = 1; 12 | * @return The service. 13 | */ 14 | java.lang.String getService(); 15 | /** 16 | * string service = 1; 17 | * @return The bytes for service. 18 | */ 19 | com.google.protobuf.ByteString 20 | getServiceBytes(); 21 | } 22 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/WebsocketApiLevelEventCountThrottleAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WebsocketApiLevelEventCountThrottleAPI", 3 | "version": "1.0.0", 4 | "context": "websocket-api-level-event-count-throttle", 5 | "description": "This API will later get updated to include the API throttling policy.", 6 | "type": "WS", 7 | "tiersCollection": "AsyncUnlimited", 8 | "operationsDTOS": [ 9 | { 10 | "verb": "SUBSCRIBE", 11 | "target": "/*", 12 | "throttlingPolicy": "Unlimited" 13 | } 14 | ], 15 | "endpoint": { 16 | "endpoint_type": "ws", 17 | "production_endpoints": { 18 | "url": "ws://mockBackend:2360/v2" 19 | }, 20 | "sandbox_endpoints": { 21 | "url": "ws://mockBackend:2360/v2" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/service/subscription/app_key_mapping_ds.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discovery.service.subscription; 4 | 5 | import "envoy/service/discovery/v3/discovery.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.service.subscription"; 9 | option java_outer_classname = "AppKeyMappingDSProto"; 10 | option java_multiple_files = true; 11 | option java_generic_services = true; 12 | 13 | // [#protodoc-title: AppKeyMappingDS] 14 | service ApplicationKeyMappingDiscoveryService { 15 | rpc StreamApplicationKeyMappings(stream envoy.service.discovery.v3.DiscoveryRequest) 16 | returns (stream envoy.service.discovery.v3.DiscoveryResponse) { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/application.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 6 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 7 | option java_outer_classname = "ApplicationProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: Application] 11 | 12 | // Application data model 13 | message Application { 14 | int32 id = 1; 15 | string uuid = 2; 16 | string name = 3; 17 | int32 subId = 4; 18 | string subName = 5; 19 | string policy = 6; 20 | string tokenType = 7; 21 | map attributes = 8; 22 | int32 tenantId = 9; 23 | string tenantDomain = 10; 24 | int64 timestamp = 11; 25 | } 26 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/application_key_mapping.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 6 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 7 | option java_outer_classname = "ApplicationKeyMappingProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: ApplicationKeyMapping] 11 | 12 | // ApplicationKeyMapping data model 13 | message ApplicationKeyMapping { 14 | string consumerKey = 1; 15 | string keyType = 2; 16 | string keyManager = 3; 17 | int32 applicationId = 4; 18 | int32 tenantId = 5; 19 | string tenantDomain = 6; 20 | int64 timestamp = 7; 21 | string applicationUUID = 8; 22 | } 23 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/WebsocketSubscriptionThrottleAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WebsocketSubscriptionThrottleAPI", 3 | "version": "1.0.0", 4 | "context": "websocket-subscription-throttle", 5 | "description": "This API includes the subscription tiers which will later be picked when creating a subscription.", 6 | "type": "WS", 7 | "tiersCollection": "5EventsPerMin", 8 | "operationsDTOS": [ 9 | { 10 | "verb": "SUBSCRIBE", 11 | "target": "/*", 12 | "throttlingPolicy": "Unlimited" 13 | } 14 | ], 15 | "endpoint": { 16 | "endpoint_type": "ws", 17 | "production_endpoints": { 18 | "url": "ws://mockBackend:2360/v2" 19 | }, 20 | "sandbox_endpoints": { 21 | "url": "ws://mockBackend:2360/v2" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/security.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | import "wso2/discovery/config/enforcer/issuer.proto"; 5 | import "wso2/discovery/config/enforcer/auth_header.proto"; 6 | import "wso2/discovery/config/enforcer/mutual_ssl.proto"; 7 | 8 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 9 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 10 | option java_outer_classname = "SecurityProto"; 11 | option java_multiple_files = true; 12 | 13 | // [#protodoc-title: Config] 14 | 15 | // Enforcer config model 16 | message Security { 17 | repeated Issuer tokenService = 1; 18 | 19 | AuthHeader authHeader = 2; 20 | 21 | MutualSSL mutualSSL = 3; 22 | } 23 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/service.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | import "wso2/discovery/config/enforcer/thread_pool.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 8 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 9 | option java_outer_classname = "ServiceProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: Service] 13 | 14 | // Auth service model 15 | message Service { 16 | int32 port = 1; 17 | 18 | int32 maxMessageSize = 2; 19 | 20 | int32 maxHeaderLimit = 3; 21 | 22 | // keep alive time of the external authz connection 23 | int32 keepAliveTime = 4; 24 | 25 | ThreadPool threadPool = 5; 26 | } 27 | -------------------------------------------------------------------------------- /envoy-filters/ci/do_ci.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | export PATH=/usr/lib/llvm-8/bin:$PATH 4 | export CC=clang 5 | export CXX=clang++ 6 | export ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-7/bin/llvm-symbolizer 7 | echo "$CC/$CXX toolchain configured" 8 | 9 | if [[ -f "${HOME:-/root}/.gitconfig" ]]; then 10 | mv "${HOME:-/root}/.gitconfig" "${HOME:-/root}/.gitconfig_save" 11 | fi 12 | 13 | function do_build () { 14 | bazel build --verbose_failures=true //:envoy 15 | } 16 | 17 | function do_test() { 18 | bazel test --test_output=all --test_env=ENVOY_IP_TEST_VERSIONS=v4only \ 19 | //:echo2_integration_test 20 | } 21 | 22 | case "$1" in 23 | build) 24 | do_build 25 | ;; 26 | test) 27 | do_test 28 | ;; 29 | *) 30 | echo "must be one of [build,test]" 31 | exit 1 32 | ;; 33 | esac 34 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/subscription.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 6 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 7 | option java_outer_classname = "SubscriptionProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: Subscription] 11 | 12 | // Subscription data model 13 | message Subscription { 14 | string subscriptionId = 1; 15 | string policyId = 2; 16 | int32 apiId = 3; 17 | int32 appId = 4; 18 | string subscriptionState = 5; 19 | int64 timeStamp = 6; 20 | int32 tenantId = 7; 21 | string tenantDomain = 8; 22 | string subscriptionUUID = 9; 23 | string appUUID = 10; 24 | string apiUUID = 11; 25 | } 26 | -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/README.md: -------------------------------------------------------------------------------- 1 | # Swagger generated server 2 | 3 | Spring Boot Server 4 | 5 | 6 | ## Overview 7 | This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. 8 | By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. 9 | This is an example of building a swagger-enabled server in Java using the SpringBoot framework. 10 | 11 | The underlying library integrating swagger to SpringBoot is [springdoc-openapi](https://github.com/springdoc/springdoc-openapi) 12 | 13 | Start your server as a simple java application 14 | 15 | You can view the api documentation in swagger-ui by pointing to 16 | http://localhost:8080/ 17 | 18 | Change default port value in application.properties -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/src/main/java/io/swagger/configuration/LocalDateConverter.java: -------------------------------------------------------------------------------- 1 | package io.swagger.configuration; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.threeten.bp.LocalDate; 5 | import org.threeten.bp.format.DateTimeFormatter; 6 | 7 | public class LocalDateConverter implements Converter { 8 | private final DateTimeFormatter formatter; 9 | 10 | public LocalDateConverter(String dateFormat) { 11 | this.formatter = DateTimeFormatter.ofPattern(dateFormat); 12 | } 13 | 14 | @Override 15 | public LocalDate convert(String source) { 16 | if(source == null || source.isEmpty()) { 17 | return null; 18 | } 19 | return LocalDate.parse(source, this.formatter); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /samples/istio/service-to-service/microservices/trains-service/Cloud.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [container.image] 16 | repository="wso2am" 17 | name="cc-trains-service" 18 | tag="1.0.0" 19 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/service/api/apids.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discovery.service.api; 4 | 5 | import "envoy/service/discovery/v3/discovery.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/api"; 8 | option java_package = "org.wso2.choreo.connect.discovery.service.api"; 9 | option java_outer_classname = "APIDsProto"; 10 | option java_multiple_files = true; 11 | option java_generic_services = true; 12 | 13 | // [#protodoc-title: APIDS] 14 | service ApiDiscoveryService { 15 | rpc StreamApis(stream envoy.service.discovery.v3.DiscoveryRequest) 16 | returns (stream envoy.service.discovery.v3.DiscoveryResponse) { 17 | } 18 | 19 | rpc FetchApis(envoy.service.discovery.v3.DiscoveryRequest) returns (envoy.service.discovery.v3.DiscoveryResponse) { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/api.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | import "wso2/discovery/subscription/url_mapping.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 8 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 9 | option java_outer_classname = "APIsProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: APIs] 13 | 14 | // APIs data model 15 | message APIs { 16 | string apiId = 1; 17 | string name = 2; 18 | string provider = 3; 19 | string version = 4; 20 | string context = 5; 21 | string policy = 6; 22 | string apiType = 7; 23 | bool isDefaultVersion = 8; 24 | URLMapping urlMappings = 9; 25 | string uuid = 10; 26 | string lcState = 11; 27 | } 28 | -------------------------------------------------------------------------------- /samples/istio/service-to-service/microservices/schedules-service/Cloud.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [container.image] 16 | repository="wso2am" 17 | name="cc-schedules-service" 18 | tag="1.0.0" 19 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/service/ga/apids.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discovery.service.ga; 4 | 5 | import "envoy/service/discovery/v3/discovery.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/ga"; 8 | option java_package = "org.wso2.choreo.connect.discovery.service.ga"; 9 | option java_outer_classname = "APIDsProto"; 10 | option java_multiple_files = false; 11 | option java_generic_services = true; 12 | 13 | // [#protodoc-title: APIDS] 14 | service ApiGADiscoveryService { 15 | rpc StreamGAApis(stream envoy.service.discovery.v3.DiscoveryRequest) 16 | returns (stream envoy.service.discovery.v3.DiscoveryResponse) { 17 | } 18 | 19 | rpc FetchGAApis(envoy.service.discovery.v3.DiscoveryRequest) returns (envoy.service.discovery.v3.DiscoveryResponse) { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/openAPIs/no_basepath_openAPI.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.0" 2 | info: 3 | version: 1.0.0 4 | title: Backend with no basepath 5 | servers: 6 | - url: http://mockBackend:2383 7 | x-wso2-basePath: /no-basepath 8 | paths: 9 | /*: 10 | get: 11 | responses: 12 | '200': 13 | description: Expected response to a valid request 14 | content: 15 | application/json: 16 | schema: 17 | $ref: "#/components/schemas/Pet" 18 | components: 19 | schemas: 20 | Pet: 21 | type: object 22 | required: 23 | - id 24 | - name 25 | properties: 26 | id: 27 | type: integer 28 | format: int64 29 | name: 30 | type: string 31 | tag: 32 | type: string 33 | -------------------------------------------------------------------------------- /adapter/test-resources/envoycodegen/asyncapi_websocket.yaml: -------------------------------------------------------------------------------- 1 | asyncapi: 2.0.0 2 | info: 3 | title: WebSocket 4 | version: "1" 5 | servers: 6 | production: 7 | url: wss://ws.ifelse.io:443 8 | protocol: ws 9 | channels: 10 | /notifications: 11 | parameters: {} 12 | publish: 13 | x-uri-mapping: /notifications 14 | x-scopes: 15 | - abc 16 | subscribe: {} 17 | /rooms/{roomID}: 18 | parameters: 19 | roomID: 20 | description: "" 21 | schema: 22 | type: string 23 | subscribe: 24 | x-uri-mapping: /rooms?room={uri.var.roomID} 25 | components: 26 | securitySchemes: 27 | oauth2: 28 | type: oauth2 29 | flows: 30 | implicit: 31 | authorizationUrl: http://localhost:9999 32 | scopes: {} 33 | x-scopes-bindings: {} 34 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/2/apps/applications.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "appName": "SoapBasicApp", 4 | "throttleTier": "Unlimited" 5 | }, 6 | { 7 | "appName": "WebSocketScopeApp", 8 | "throttleTier": "Unlimited" 9 | }, 10 | { 11 | "appName": "WebSocketTimeoutApp", 12 | "throttleTier": "Unlimited" 13 | }, 14 | { 15 | "appName": "KeyTemplateThrottlingApp", 16 | "throttleTier": "Unlimited" 17 | }, 18 | { 19 | "appName": "GraphQLThrottlingApp", 20 | "throttleTier": "Unlimited" 21 | }, 22 | { 23 | "appName": "GraphQLScopeApp", 24 | "throttleTier": "Unlimited" 25 | }, 26 | { 27 | "appName": "GraphQLBasicApp", 28 | "throttleTier": "Unlimited" 29 | }, 30 | { 31 | "appName": "CompressionTestApp", 32 | "throttleTier": "Unlimited" 33 | } 34 | ] 35 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/openAPIs/all_http_methods_for_wildcard_openAPI.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.0" 2 | info: 3 | version: 1.0.0 4 | title: Trailing Slash For Wildcard 5 | servers: 6 | - url: http://mockBackend:2383/v2/echo-full 7 | x-wso2-basePath: /all_http_methods_for_wildcard 8 | paths: 9 | /*: 10 | get: 11 | responses: 12 | '200': 13 | description: OK 14 | put: 15 | responses: 16 | '200': 17 | description: OK 18 | post: 19 | responses: 20 | '200': 21 | description: OK 22 | delete: 23 | responses: 24 | '200': 25 | description: OK 26 | head: 27 | responses: 28 | '200': 29 | description: OK 30 | patch: 31 | responses: 32 | '200': 33 | description: OK 34 | 35 | -------------------------------------------------------------------------------- /samples/interceptors/sample-backend/cc-sample-legacy-xml-backend/Cloud.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [container.image] 16 | repository="wso2am" 17 | name="cc-sample-legacy-xml-backend" 18 | tag="v1.0.0" 19 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/service/config/cds.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discovery.service.config; 4 | 5 | import "envoy/service/discovery/v3/discovery.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/config"; 8 | option java_package = "org.wso2.choreo.connect.discovery.service.config"; 9 | option java_outer_classname = "CdsProto"; 10 | option java_multiple_files = true; 11 | option java_generic_services = true; 12 | 13 | // [#protodoc-title: CDS] 14 | service ConfigDiscoveryService { 15 | rpc StreamConfigs(stream envoy.service.discovery.v3.DiscoveryRequest) 16 | returns (stream envoy.service.discovery.v3.DiscoveryResponse) { 17 | } 18 | 19 | rpc FetchConfigs(envoy.service.discovery.v3.DiscoveryRequest) returns (envoy.service.discovery.v3.DiscoveryResponse) { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/dockerCompose/backend-service-with-tls-and-network.yaml: -------------------------------------------------------------------------------- 1 | - "5006:5006" 2 | mockBackend: 3 | image: wso2/choreo-connect-mock-backend:1.3.0-m1-SNAPSHOT 4 | command: java -cp "lib/*" org.wso2.choreo.connect.mockbackend.MockServices -tls-enabled -interceptor-svc-enabled -async-enabled -soap-enabled -gql-enabled -http2-tls-server-enabled 5 | ports: 6 | - "2383:2383" 7 | - "2399:2399" 8 | - "2370:2370" 9 | - "2371:2371" 10 | - "2360:2360" 11 | - "2340:2340" 12 | - "2320:2320" 13 | networks: 14 | - cc_internal 15 | mockBackend2: 16 | image: wso2/choreo-connect-mock-backend:1.3.0-m1-SNAPSHOT 17 | command: java -cp "lib/*" org.wso2.choreo.connect.mockbackend.MockServices -http2-server-enabled 18 | networks: 19 | - cc_internal 20 | -------------------------------------------------------------------------------- /samples/interceptors/README.md: -------------------------------------------------------------------------------- 1 | # Sample Interceptors 2 | 3 | To learn about interceptors and for instructions on how to run it please head over to the 4 | [Choreo-Connect docs](https://apim.docs.wso2.com/en/latest/deploy-and-publish/deploy-on-gateway/choreo-connect/message-transformation/message-transformation-overview/). 5 | 6 | ## Samples 7 | 8 | - Sample Interceptor Service Implementations 9 | - [Ballerina](ballerina) 10 | - [Java](java) 11 | - [NodeJS](nodejs) 12 | - [Go](golang) 13 | - [WSO2 Micro Integrator](wso2-micro-integrator) 14 | - [Sample Backend](sample-backend) 15 | 16 | ## Sample Certs and Resources for Interceptors 17 | 18 | The directory [resources](resources) contains the sample certs for interceptors. Use following command to create self-signed certs for dev purposes. 19 | 20 | ```shell 21 | ./create-certs.sh 22 | ``` 23 | -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/src/main/java/io/swagger/configuration/LocalDateTimeConverter.java: -------------------------------------------------------------------------------- 1 | package io.swagger.configuration; 2 | 3 | import org.springframework.core.convert.converter.Converter; 4 | import org.threeten.bp.LocalDateTime; 5 | import org.threeten.bp.format.DateTimeFormatter; 6 | 7 | public class LocalDateTimeConverter implements Converter { 8 | private final DateTimeFormatter formatter; 9 | 10 | public LocalDateTimeConverter(String dateFormat) { 11 | this.formatter = DateTimeFormatter.ofPattern(dateFormat); 12 | } 13 | 14 | @Override 15 | public LocalDateTime convert(String source) { 16 | if(source == null || source.isEmpty()) { 17 | return null; 18 | } 19 | return LocalDateTime.parse(source, this.formatter); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /samples/rest-to-soap-conversion/PhoneVerification/PhoneVerificationConfigs/src/main/resources/metadata/PhoneVerify_swagger.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.1 2 | info: 3 | title: PhoneVerify 4 | description: API Definition of PhoneVerify 5 | version: 1.0.0 6 | servers: 7 | - url: http://172.17.0.1:8290/phoneverify 8 | paths: 9 | /checkphonenumber: 10 | get: 11 | parameters: 12 | - name: PhoneNumber 13 | in: query 14 | required: false 15 | style: form 16 | explode: true 17 | schema: 18 | type: string 19 | - name: LicenseKey 20 | in: query 21 | required: false 22 | style: form 23 | explode: true 24 | schema: 25 | type: string 26 | responses: 27 | default: 28 | description: Default response 29 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/openAPIs/api_key_blocked_openAPI.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.0" 2 | info: 3 | version: 1.0.5 4 | title: API key Blocked API 5 | servers: 6 | - url: http://mockBackend:2383/v2 7 | paths: 8 | '/pet/{petId}': 9 | get: 10 | summary: Find pet by ID 11 | parameters: 12 | - name: petId 13 | in: path 14 | description: ID of pet to return 15 | required: true 16 | schema: 17 | type: integer 18 | format: int64 19 | responses: 20 | '200': 21 | description: successful operation 22 | '404': 23 | description: Pet not found 24 | security: 25 | - APIKeyAuth: [] 26 | components: 27 | securitySchemes: 28 | APIKeyAuth: 29 | type: apiKey 30 | name: x-api-key 31 | in: header 32 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/service/keymgt/kmds.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.service.keymgt; 4 | 5 | import "envoy/service/discovery/v3/discovery.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/keymgt"; 8 | option java_package = "org.wso2.choreo.connect.discovery.service.keymgt"; 9 | option java_outer_classname = "KmdsProto"; 10 | option java_multiple_files = true; 11 | option java_generic_services = true; 12 | 13 | // [#protodoc-title: KMDS] 14 | service KMDiscoveryService { 15 | rpc StreamKeyManagers(stream envoy.service.discovery.v3.DiscoveryRequest) 16 | returns (stream envoy.service.discovery.v3.DiscoveryResponse) { 17 | } 18 | 19 | rpc FetchKeyManagers(envoy.service.discovery.v3.DiscoveryRequest) 20 | returns (envoy.service.discovery.v3.DiscoveryResponse) { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/subscription/subscription_policy.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.subscription; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/subscription;subscription"; 6 | option java_package = "org.wso2.choreo.connect.discovery.subscription"; 7 | option java_outer_classname = "SubscriptionPolicyProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: SubscriptionPolicy] 11 | 12 | // SubscriptionPolicy data model 13 | message SubscriptionPolicy { 14 | int32 id = 1; 15 | int32 tenantId = 2; 16 | string name = 3; 17 | string quotaType = 4; 18 | int32 graphQLMaxComplexity = 5; 19 | int32 graphQLMaxDepth = 6; 20 | int32 rateLimitCount = 7; 21 | string rateLimitTimeUnit = 8; 22 | bool stopOnQuotaReach = 9; 23 | string tenantDomain = 10; 24 | int64 timestamp = 11; 25 | } 26 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/config/enforcer/CacheOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/discovery/config/enforcer/cache.proto 3 | 4 | package org.wso2.choreo.connect.discovery.config.enforcer; 5 | 6 | public interface CacheOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:wso2.discovery.config.enforcer.Cache) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * bool enable = 1; 12 | * @return The enable. 13 | */ 14 | boolean getEnable(); 15 | 16 | /** 17 | * int32 maximumSize = 2; 18 | * @return The maximumSize. 19 | */ 20 | int getMaximumSize(); 21 | 22 | /** 23 | * sint32 expiryTime = 3; 24 | * @return The expiryTime. 25 | */ 26 | int getExpiryTime(); 27 | } 28 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/binary_publisher.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | import "wso2/discovery/config/enforcer/tm_url_group.proto"; 6 | import "wso2/discovery/config/enforcer/throttle_publisher_pool.proto"; 7 | import "wso2/discovery/config/enforcer/throttle_agent.proto"; 8 | 9 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 10 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 11 | option java_outer_classname = "BinaryPublisherProto"; 12 | option java_multiple_files = true; 13 | 14 | // [#protodoc-title: BinaryPublisher] 15 | 16 | message BinaryPublisher { 17 | string username = 1; 18 | string password = 2; 19 | repeated TMURLGroup urlGroup = 3; 20 | PublisherPool pool = 4; 21 | ThrottleAgent agent = 5; 22 | } 23 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/RetryAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RetryAPI", 3 | "version": "1.0.0", 4 | "context": "retry", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/retry-four", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2383/v2", 18 | "config": { 19 | "retryTimeOut": "3", 20 | "actionDuration": "30000", 21 | "actionSelect": "discard", 22 | "factor": "", 23 | "retryDelay": "", 24 | "retryErroCode": [], 25 | "suspendDuration": "", 26 | "suspendErrorCode": [], 27 | "suspendMaxDuration": "" 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/TimeoutAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TimeoutAPI", 3 | "version": "1.0.0", 4 | "context": "timeout", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/delay-4", 11 | "throttlingPolicy": "Unlimited" 12 | } 13 | ], 14 | "endpoint": { 15 | "endpoint_type": "http", 16 | "production_endpoints": { 17 | "url": "http://mockBackend:2383/v2", 18 | "config": { 19 | "retryTimeOut": "", 20 | "actionDuration": "3000", 21 | "actionSelect": "discard", 22 | "factor": "", 23 | "retryDelay": "", 24 | "retryErroCode": [], 25 | "suspendDuration": "", 26 | "suspendErrorCode": [], 27 | "suspendMaxDuration": "" 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /samples/interceptors/golang/go-interceptor-server-generated/go/README.md: -------------------------------------------------------------------------------- 1 | # Go API Server for swagger 2 | 3 | Interceptor Service 4 | 5 | ## Overview 6 | This server was generated by the [swagger-codegen] 7 | (https://github.com/swagger-api/swagger-codegen) project. 8 | By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. 9 | - 10 | 11 | To see how to make this your own, look here: 12 | 13 | [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) 14 | 15 | - API version: v1 16 | - Build date: 2021-11-07T10:09:40.216Z[GMT] 17 | For more information, please visit [http://wso2.com/products/api-manager/](http://wso2.com/products/api-manager/) 18 | 19 | 20 | ### Running the server 21 | To run the server, follow these simple steps: 22 | 23 | ``` 24 | go run main.go 25 | ``` 26 | -------------------------------------------------------------------------------- /adapter/pkg/metrics/types.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com) 3 | * 4 | * WSO2 LLC. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package metrics 20 | 21 | const ( 22 | // PrometheusMetricType prometheus metric type 23 | PrometheusMetricType = "prometheus" 24 | ) 25 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/service/throttle/tdds.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package discovery.service.throttle; 4 | 5 | import "envoy/service/discovery/v3/discovery.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/service/throttle"; 8 | option java_package = "org.wso2.choreo.connect.discovery.service.throttle"; 9 | option java_outer_classname = "TDdsProto"; 10 | option java_multiple_files = true; 11 | option java_generic_services = true; 12 | 13 | // [#protodoc-title: TDDS] 14 | service ThrottleDataDiscoveryService { 15 | rpc StreamThrottleData(stream envoy.service.discovery.v3.DiscoveryRequest) 16 | returns (stream envoy.service.discovery.v3.DiscoveryResponse) { 17 | } 18 | 19 | rpc FetchThrottleData(envoy.service.discovery.v3.DiscoveryRequest) 20 | returns (envoy.service.discovery.v3.DiscoveryResponse) { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /samples/istio/service-to-service/microservices/trains-service/Ballerina.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | org = "wso2am" 17 | name = "cc_trains_service" 18 | version = "1.0.0" 19 | 20 | [build-options] 21 | observabilityIncluded = false 22 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/keymgt/RevokedTokenOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/discovery/keymgt/revoked_tokens.proto 3 | 4 | package org.wso2.choreo.connect.discovery.keymgt; 5 | 6 | public interface RevokedTokenOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:wso2.discovery.keymgt.RevokedToken) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * string jti = 1; 12 | * @return The jti. 13 | */ 14 | java.lang.String getJti(); 15 | /** 16 | * string jti = 1; 17 | * @return The bytes for jti. 18 | */ 19 | com.google.protobuf.ByteString 20 | getJtiBytes(); 21 | 22 | /** 23 | * int64 expirytime = 2; 24 | * @return The expirytime. 25 | */ 26 | long getExpirytime(); 27 | } 28 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/asyncAPIs/websocket_topic_asyncAPI.yaml: -------------------------------------------------------------------------------- 1 | asyncapi: 2.0.0 2 | info: 3 | title: WebSocketTopicAPI 4 | version: 1.0.0 5 | servers: 6 | production: 7 | url: 'ws://mockBackend:2360/v2' 8 | protocol: ws 9 | channels: 10 | /notifications: 11 | publish: 12 | x-uri-mapping: /notifications 13 | x-auth-type: Any 14 | /noMapping: 15 | publish: {} 16 | x-auth-type: Any 17 | '/rooms/{roomID}': 18 | publish: 19 | x-uri-mapping: '/rooms?room={uri.var.roomID}' 20 | parameters: 21 | roomID: 22 | description: '' 23 | schema: 24 | type: string 25 | components: 26 | securitySchemes: 27 | oauth2: 28 | type: oauth2 29 | flows: 30 | implicit: 31 | authorizationUrl: 'http://localhost:9999' 32 | scopes: {} 33 | x-scopes-bindings: {} 34 | -------------------------------------------------------------------------------- /samples/istio/service-to-service/microservices/schedules-service/Ballerina.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | org = "wso2am" 17 | name = "cc_schedules_service" 18 | version = "1.0.0" 19 | 20 | [build-options] 21 | observabilityIncluded = false 22 | -------------------------------------------------------------------------------- /samples/interceptors/sample-backend/cc-sample-legacy-xml-backend/Ballerina.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [package] 16 | org = "wso2am" 17 | name = "cc_sample_legacy_xml_backend" 18 | version = "1.0.0" 19 | 20 | [build-options] 21 | observabilityIncluded = false 22 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/configs/client-cert-encode-config.toml: -------------------------------------------------------------------------------- 1 | [router.downstream.tls] 2 | mTLSAPIsEnabled = true 3 | 4 | [enforcer.security.mutualSSL] 5 | enableClientValidation = false 6 | clientCertificateEncode = true 7 | 8 | # For API key without APIM 9 | [[enforcer.security.tokenService]] 10 | name = "Resident Key Manager" 11 | issuer = "https://localhost:9443/oauth2/token" 12 | certificateAlias = "wso2carbon" 13 | jwksURL = "" 14 | validateSubscription = false 15 | consumerKeyClaim = "azp" 16 | certificateFilePath = "/home/wso2/security/truststore/wso2carbon.pem" 17 | 18 | [[enforcer.security.tokenService]] 19 | name = "APIM Publisher" 20 | issuer = "https://localhost:9443/publisher" 21 | validateSubscription = false # set this to false when using API key without APIM 22 | certificateAlias = "" 23 | certificateFilePath = "/home/wso2/security/truststore/wso2carbon.pem" 24 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/throttling.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | import "wso2/discovery/config/enforcer/binary_publisher.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 8 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 9 | option java_outer_classname = "ThrottlingProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: Throttling] 13 | 14 | // Throttling model 15 | message Throttling { 16 | bool enable_global_event_publishing = 1; 17 | bool enable_header_conditions = 2; 18 | bool enable_query_param_conditions = 3; 19 | bool enable_jwt_claim_conditions = 4; 20 | string jms_connection_initial_context_factory = 5; 21 | string jms_connection_provider_url = 6; 22 | BinaryPublisher publisher = 7; 23 | } 24 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/configs/client-cert-not-encode-config.toml: -------------------------------------------------------------------------------- 1 | [router.downstream.tls] 2 | mTLSAPIsEnabled = true 3 | 4 | [enforcer.security.mutualSSL] 5 | enableClientValidation = false 6 | clientCertificateEncode = false 7 | 8 | # For API key without APIM 9 | [[enforcer.security.tokenService]] 10 | name = "Resident Key Manager" 11 | issuer = "https://localhost:9443/oauth2/token" 12 | certificateAlias = "wso2carbon" 13 | jwksURL = "" 14 | validateSubscription = false 15 | consumerKeyClaim = "azp" 16 | certificateFilePath = "/home/wso2/security/truststore/wso2carbon.pem" 17 | 18 | [[enforcer.security.tokenService]] 19 | name = "APIM Publisher" 20 | issuer = "https://localhost:9443/publisher" 21 | validateSubscription = false # set this to false when using API key without APIM 22 | certificateAlias = "" 23 | certificateFilePath = "/home/wso2/security/truststore/wso2carbon.pem" 24 | -------------------------------------------------------------------------------- /api/proto/wso2/health/service/health.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package grpc.health.v1; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/health/service"; 6 | option java_package = "org.wso2.choreo.connect.discovery.service.health"; 7 | option java_outer_classname = "HealthProto"; 8 | option java_multiple_files = true; 9 | option java_generic_services = true; 10 | 11 | message HealthCheckRequest { 12 | string service = 1; 13 | } 14 | 15 | message HealthCheckResponse { 16 | enum ServingStatus { 17 | UNKNOWN = 0; 18 | SERVING = 1; 19 | NOT_SERVING = 2; 20 | SERVICE_UNKNOWN = 3; // Used only by the Watch method. 21 | } 22 | ServingStatus status = 1; 23 | } 24 | 25 | // [#protodoc-title: Health] 26 | service Health { 27 | rpc Check(HealthCheckRequest) returns (HealthCheckResponse); 28 | 29 | rpc Watch(HealthCheckRequest) returns (stream HealthCheckResponse); 30 | } 31 | -------------------------------------------------------------------------------- /samples/rest-to-soap-conversion/PhoneVerification/PhoneVerificationConfigs/artifact.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | src/main/synapse-config/api/PhoneVerify.xml 6 | 7 | 9 | src/main/resources/metadata/PhoneVerify_swagger.yaml 10 | 11 | 13 | src/main/resources/metadata/PhoneVerify_metadata.yaml 14 | 15 | 16 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/service/health/HealthCheckResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/health/service/health.proto 3 | 4 | package org.wso2.choreo.connect.discovery.service.health; 5 | 6 | public interface HealthCheckResponseOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:grpc.health.v1.HealthCheckResponse) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * .grpc.health.v1.HealthCheckResponse.ServingStatus status = 1; 12 | * @return The enum numeric value on the wire for status. 13 | */ 14 | int getStatusValue(); 15 | /** 16 | * .grpc.health.v1.HealthCheckResponse.ServingStatus status = 1; 17 | * @return The status. 18 | */ 19 | org.wso2.choreo.connect.discovery.service.health.HealthCheckResponse.ServingStatus getStatus(); 20 | } 21 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/jwt_issuer.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | import "wso2/discovery/config/enforcer/jwt_user.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 8 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 9 | option java_outer_classname = "JWTIssuerProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: JWTIssuer] 13 | 14 | // JWT Issuer model 15 | message JWTIssuer { 16 | 17 | bool enabled = 1; 18 | 19 | string issuer = 2; 20 | 21 | string encoding = 3; 22 | 23 | string claim_dialect = 4; 24 | 25 | string signing_algorithm = 5; 26 | 27 | string public_certificate_path = 6; 28 | 29 | string private_key_path = 7; 30 | 31 | int32 validity_period = 8; 32 | 33 | repeated JWTUser jwt_users = 9; 34 | } 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/task_form.yml: -------------------------------------------------------------------------------- 1 | name: "✍️ Create a Task" 2 | description: Create a new task. 3 | labels: ["Priority/Normal", "Type/Task"] 4 | body: 5 | - type: textarea 6 | id: description 7 | attributes: 8 | label: Description 9 | description: A clear description of what needs to be done. 10 | validations: 11 | required: true 12 | - type: input 13 | id: version 14 | attributes: 15 | label: Version 16 | description: Enter component version. 17 | validations: 18 | required: false 19 | - type: textarea 20 | id: related 21 | attributes: 22 | label: Related Issues 23 | description: Mention if any related issues. 24 | validations: 25 | required: false 26 | - type: input 27 | id: suggested 28 | attributes: 29 | label: Suggested Labels 30 | description: Mention if any suggested labels. 31 | validations: 32 | required: false -------------------------------------------------------------------------------- /samples/interceptors/ballerina/cc-sample-xml-interceptor/Cloud.toml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [container.image] 16 | repository="wso2am" 17 | name="cc-sample-xml-interceptor-ballerina" 18 | tag="v1.0.0" 19 | 20 | [[container.copy.files]] 21 | sourceFile="../resources/certs" 22 | target="/home/ballerina/certs" 23 | -------------------------------------------------------------------------------- /samples/interceptors/golang/go-interceptor-server-generated/go/model_response_handler_response_body.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Choreo-Connect Interceptor Service 3 | * 4 | * Interceptor Service 5 | * 6 | * API version: v1 7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) 8 | */ 9 | package swagger 10 | 11 | type ResponseHandlerResponseBody struct { 12 | ResponseCode int32 `json:"responseCode,omitempty"` 13 | 14 | HeadersToAdd *map[string]string `json:"headersToAdd,omitempty"` 15 | 16 | HeadersToReplace *map[string]string `json:"headersToReplace,omitempty"` 17 | 18 | HeadersToRemove *[]string `json:"headersToRemove,omitempty"` 19 | 20 | TrailersToAdd *map[string]string `json:"trailersToAdd,omitempty"` 21 | 22 | TrailersToReplace *map[string]string `json:"trailersToReplace,omitempty"` 23 | 24 | TrailersToRemove *[]string `json:"trailersToRemove,omitempty"` 25 | 26 | Body string `json:"body,omitempty"` 27 | } 28 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/opaPolicy_v1.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: OPA 3 | parameters: 4 | requestGenerator: "" 5 | serverURL: {{ .serverUrl }} 6 | {{- if isParamExists . "accessKey" }} 7 | accessKey: {{ .accessKey }} 8 | {{- end }} 9 | policy: {{ .policy }} 10 | rule: {{ .rule }} 11 | {{- if isParamExists . "sendAccessToken" }} 12 | sendAccessToken: {{ .sendAccessToken }} 13 | {{- end }} 14 | {{- if isParamExists . "additionalProperties" }} 15 | additionalProperties: {{ .additionalProperties }} 16 | {{- end }} 17 | {{- if isParamExists . "maxOpenConnections" }} 18 | maxOpenConnections: {{ .maxOpenConnections }} 19 | {{- end }} 20 | {{- if isParamExists . "maxPerRoute" }} 21 | maxPerRoute: {{ .maxPerRoute }} 22 | {{- end }} 23 | {{- if isParamExists . "connectionTimeout" }} 24 | connectionTimeout: {{ .connectionTimeout }} 25 | {{- end }} 26 | -------------------------------------------------------------------------------- /samples/interceptors/golang/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -ex 17 | IMAGE_NAME=wso2am/cc-sample-xml-interceptor-go 18 | VERSION=v1.0.0 19 | 20 | SRC="go-interceptor-server-generated" 21 | 22 | cp -r ../resources/certs "${SRC}/certs" 23 | cd $SRC 24 | docker build -t $IMAGE_NAME:$VERSION --build-arg CERT_DIR=certs . 25 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/ccAddHeader_v1.yaml: -------------------------------------------------------------------------------- 1 | type: operation_policy_specification 2 | version: v4.1.0 3 | data: 4 | category: Mediation 5 | name: ccAddHeader 6 | version: v1 7 | displayName: Add Header 8 | description: This policy allows you to add a new header to the request 9 | applicableFlows: 10 | - request 11 | - response 12 | supportedGateways: 13 | - ChoreoConnect 14 | supportedApiTypes: 15 | - HTTP 16 | policyAttributes: 17 | - 18 | name: headerName 19 | displayName: Header Name 20 | description: Name of the header to be added 21 | validationRegex: "^([a-zA-Z_][a-zA-Z\\d_\\-\\ ]*)$" 22 | type: String 23 | allowedValues: [] 24 | required: true 25 | - 26 | name: headerValue 27 | displayName: Header Value 28 | description: Value of the header 29 | validationRegex: "^([a-zA-Z\\d_][a-zA-Z\\d_\\-\\ ]*)$" 30 | type: String 31 | allowedValues: [] 32 | required: true 33 | -------------------------------------------------------------------------------- /samples/interceptors/nodejs/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -ex 17 | IMAGE_NAME=wso2am/cc-sample-xml-interceptor-nodejs 18 | VERSION=v1.0.0 19 | 20 | SRC="nodejs-interceptor-server-generated" 21 | 22 | cp -r ../resources/certs "${SRC}/certs" 23 | cd $SRC 24 | docker build -t $IMAGE_NAME:$VERSION --build-arg CERT_DIR=certs . 25 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/addQueryParam_v1.yaml: -------------------------------------------------------------------------------- 1 | type: operation_policy_specification 2 | version: v4.1.0 3 | data: 4 | category: Mediation 5 | name: addQueryParam 6 | version: v1 7 | displayName: Add Query Param 8 | description: This policy allows you to add a query parameter to the request 9 | applicableFlows: 10 | - request 11 | supportedGateways: 12 | - Synapse 13 | - ChoreoConnect 14 | supportedApiTypes: 15 | - HTTP 16 | policyAttributes: 17 | - 18 | name: paramKey 19 | displayName: Parameter Key 20 | description: Query parameter's key 21 | validationRegex: "^([a-zA-Z_][a-zA-Z\\d_\\-\\ ]*)$" 22 | type: String 23 | allowedValues: [] 24 | required: true 25 | - 26 | name: paramValue 27 | displayName: Parameter Value 28 | description: Query parameter's Value 29 | validationRegex: "^([a-zA-Z\\d_][a-zA-Z\\d_\\-\\ ]*)$" 30 | type: String 31 | allowedValues: [] 32 | required: true 33 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/customAddHeader_v1.yaml: -------------------------------------------------------------------------------- 1 | type: operation_policy_specification 2 | version: v4.1.0 3 | data: 4 | category: Mediation 5 | name: customAddHeader 6 | version: v1 7 | displayName: Custom Add Header 8 | description: This policy allows you to add a new header to the request 9 | applicableFlows: 10 | - request 11 | supportedGateways: 12 | - ChoreoConnect 13 | supportedApiTypes: 14 | - HTTP 15 | policyAttributes: 16 | - 17 | name: customHeaderName 18 | displayName: Header Name 19 | description: Name of the header to be added 20 | validationRegex: "^([a-zA-Z_][a-zA-Z\\d_\\-\\ ]*)$" 21 | type: String 22 | allowedValues: [] 23 | required: true 24 | - 25 | name: customHeaderValue 26 | displayName: Header Value 27 | description: Value of the header 28 | validationRegex: "^([a-zA-Z\\d_][a-zA-Z\\d_\\-\\ ]*)$" 29 | type: String 30 | allowedValues: [] 31 | required: true 32 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policiesInvalid/ccAddHeaderNotSupportedParam_v1.yaml: -------------------------------------------------------------------------------- 1 | type: operation_policy_specification 2 | version: v4.1.0 3 | data: 4 | category: Mediation 5 | name: ccAddHeaderNotSupportedParam 6 | version: v1 7 | displayName: Add Header 8 | description: This policy allows you to add a new header to the request 9 | applicableFlows: 10 | - request 11 | supportedGateways: 12 | - ChoreoConnect 13 | supportedApiTypes: 14 | - HTTP 15 | policyAttributes: 16 | - 17 | name: headerName 18 | displayName: Header Name 19 | description: Name of the header to be added 20 | validationRegex: "^([a-zA-Z_][a-zA-Z\\d_\\-\\ ]*)$" 21 | type: String 22 | allowedValues: [] 23 | required: true 24 | - 25 | name: headerValue 26 | displayName: Header Value 27 | description: Value of the header 28 | validationRegex: "^([a-zA-Z\\d_][a-zA-Z\\d_\\-\\ ]*)$" 29 | type: String 30 | allowedValues: [] 31 | required: true 32 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policiesInvalid/ccAddHeaderNotSupportedAction_v1.yaml: -------------------------------------------------------------------------------- 1 | type: operation_policy_specification 2 | version: v4.1.0 3 | data: 4 | category: Mediation 5 | name: ccAddHeaderNotSupportedAction 6 | version: v1 7 | displayName: Add Header 8 | description: This policy allows you to add a new header to the request 9 | applicableFlows: 10 | - request 11 | supportedGateways: 12 | - ChoreoConnect 13 | supportedApiTypes: 14 | - HTTP 15 | policyAttributes: 16 | - 17 | name: headerName 18 | displayName: Header Name 19 | description: Name of the header to be added 20 | validationRegex: "^([a-zA-Z_][a-zA-Z\\d_\\-\\ ]*)$" 21 | type: String 22 | allowedValues: [] 23 | required: true 24 | - 25 | name: headerValue 26 | displayName: Header Value 27 | description: Value of the header 28 | validationRegex: "^([a-zA-Z\\d_][a-zA-Z\\d_\\-\\ ]*)$" 29 | type: String 30 | allowedValues: [] 31 | required: true 32 | -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM adoptopenjdk/openjdk11:jre-11.0.11_9-alpine 16 | RUN addgroup -S wso2am && adduser -S wso2am -G wso2am 17 | USER wso2am:wso2am 18 | 19 | ARG JAR_FILE=target/*.jar 20 | COPY ${JAR_FILE} interceptor-svc.jar 21 | 22 | EXPOSE 9081 23 | ENTRYPOINT ["java","-jar","/interceptor-svc.jar"] 24 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/git-artifacts/directory/petstore/api.yaml: -------------------------------------------------------------------------------- 1 | type: api 2 | version: v4.0.0 3 | data: 4 | name: SwaggerPetstore 5 | description: 'This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.' 6 | context: /v2 7 | version: 1.0.6 8 | provider: admin 9 | lifeCycleStatus: CREATED 10 | isRevision: false 11 | revisionId: 0 12 | type: HTTP 13 | transport: 14 | - http 15 | - https 16 | tags: 17 | - pet 18 | - store 19 | - user 20 | policies: 21 | - Unlimited 22 | visibility: PUBLIC 23 | endpointConfig: 24 | endpoint_type: http 25 | production_endpoints: 26 | url: http://localhost:8080 27 | sandbox_endpoints: 28 | url: http://localhost:8081 29 | endpointImplementationType: ENDPOINT 30 | websubSubscriptionConfiguration: null 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | 25 | target 26 | .classpath 27 | .settings 28 | .project 29 | .vscode 30 | .idea 31 | *.DS_Store 32 | *.iml 33 | *dependency-reduced-pom.xml 34 | *.lock 35 | *.factorypath 36 | vendor 37 | 38 | # envoy filters 39 | envoy-filters/**/bazel-* 40 | envoy-filters/.vscode 41 | envoy-filters/.idea 42 | 43 | # executable 44 | adapter/micro-gw 45 | 46 | !integration/test-integration/src/test/resources/git-artifacts/** 47 | !samples/rest-to-soap-conversion/PhoneVerification/** 48 | 49 | # test case relevant files 50 | integration/mock-backend-server/src/main/resources/schema.graphql 51 | integration/test-integration/src/test/resources/testng-cc-with-latest-apim.xml 52 | -------------------------------------------------------------------------------- /samples/interceptors/golang/go-interceptor-server-generated/go/model_response_handler_request_body.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Choreo-Connect Interceptor Service 3 | * 4 | * Interceptor Service 5 | * 6 | * API version: v1 7 | * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) 8 | */ 9 | package swagger 10 | 11 | type ResponseHandlerRequestBody struct { 12 | ResponseCode int32 `json:"responseCode"` 13 | 14 | RequestHeaders *map[string]string `json:"requestHeaders,omitempty"` 15 | 16 | RequestTrailers *map[string]string `json:"requestTrailers,omitempty"` 17 | 18 | RequestBody string `json:"requestBody,omitempty"` 19 | 20 | ResponseHeaders *map[string]string `json:"responseHeaders,omitempty"` 21 | 22 | ResponseTrailers *map[string]string `json:"responseTrailers,omitempty"` 23 | 24 | ResponseBody string `json:"responseBody,omitempty"` 25 | 26 | InvocationContext *InvocationContext `json:"invocationContext,omitempty"` 27 | 28 | InterceptorContext *map[string]string `json:"interceptorContext,omitempty"` 29 | } 30 | -------------------------------------------------------------------------------- /samples/interceptors/java/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -ex 17 | IMAGE_NAME=wso2am/cc-sample-xml-interceptor-java 18 | VERSION=v1.0.0 19 | 20 | SRC="spring-server-generated" 21 | 22 | # copy the keystore file from resources 23 | cp ../resources/interceptor.jks "${SRC}/src/main/resources/interceptor.jks" 24 | 25 | cd $SRC 26 | mvn clean package; 27 | docker build -t $IMAGE_NAME:$VERSION . 28 | -------------------------------------------------------------------------------- /samples/istio/mtls-mode/create-certs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | DOMAIN=istio-ingressgateway.istio-system 17 | 18 | openssl genpkey -out server.key -algorithm RSA -pkeyopt rsa_keygen_bits:2048 19 | openssl req -x509 -new -key server.key -out server.crt -subj "/CN=${DOMAIN}" -reqexts SAN -extensions SAN \ 20 | -config <(cat /etc/ssl/openssl.cnf <(printf "[SAN]\nsubjectAltName=DNS:${DOMAIN}")) 21 | 22 | -------------------------------------------------------------------------------- /adapter/internal/oasparser/model/mgw_swagger_dummy.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package model 19 | 20 | // CreateDummyMgwSwaggerForAWSLambdaTests creates a dummy MgwSwagger struct to be used for aws lambda unit tests 21 | func CreateDummyMgwSwaggerForAWSLambdaTests(resources []*Resource) *MgwSwagger { 22 | return &MgwSwagger{ 23 | resources: resources, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/git-artifacts/zip/petstore1/Definitions/swagger.yaml: -------------------------------------------------------------------------------- 1 | basePath: /v2 2 | x-wso2-basePath: /zip 3 | host: mockBackend:2383 4 | info: 5 | title: Swagger Petstore Zip 6 | version: 1.0.6 7 | paths: 8 | /store/inventory: 9 | get: 10 | summary: Returns pet inventories by status 11 | parameters: [] 12 | produces: 13 | - application/json 14 | responses: 15 | "200": 16 | description: successful operation 17 | definitions: 18 | Pet: 19 | properties: 20 | id: 21 | format: int64 22 | type: integer 23 | name: 24 | example: doggie 25 | type: string 26 | required: 27 | - name 28 | type: object 29 | schemes: 30 | - http 31 | securityDefinitions: 32 | petstore_auth: 33 | authorizationUrl: https://petstore.swagger.io/oauth/authorize 34 | flow: implicit 35 | scopes: 36 | read:pets: read your pets 37 | write:pets: modify pets in your account 38 | type: oauth2 39 | swagger: "2.0" 40 | 41 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/MockedContentExampleOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/discovery/api/mocked_api_config.proto 3 | 4 | package org.wso2.choreo.connect.discovery.api; 5 | 6 | public interface MockedContentExampleOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:wso2.discovery.api.MockedContentExample) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * string Ref = 1; 12 | * @return The ref. 13 | */ 14 | java.lang.String getRef(); 15 | /** 16 | * string Ref = 1; 17 | * @return The bytes for ref. 18 | */ 19 | com.google.protobuf.ByteString 20 | getRefBytes(); 21 | 22 | /** 23 | * string body = 2; 24 | * @return The body. 25 | */ 26 | java.lang.String getBody(); 27 | /** 28 | * string body = 2; 29 | * @return The bytes for body. 30 | */ 31 | com.google.protobuf.ByteString 32 | getBodyBytes(); 33 | } 34 | -------------------------------------------------------------------------------- /samples/interceptors/sample-backend/README.md: -------------------------------------------------------------------------------- 1 | # Sample Backend 2 | 3 | This sample backend represent a Legacy XML Backend which requires a header `x-user` with the value `admin` for 4 | successfully process the request. Otherwise, it responds with `401` status code. 5 | 6 | When it successfully inserted a book it responds with `200` status code with a `text/plain` content. 7 | 8 | ## Prerequisites 9 | - Docker 10 | - Ballerina Swan Lake Beta 3 11 | 12 | ## Build and Test the sample 13 | 14 | 1. Build the backend service. 15 | ```sh 16 | bal build --cloud=docker cc-sample-legacy-xml-backend/ 17 | ``` 18 | 19 | 2. Test the backend service. 20 | ```sh 21 | docker run --name lagacy-backend -p 9080:9080 wso2am/cc-sample-legacy-xml-backend:v1.0.0 22 | ``` 23 | 24 | In another shell 25 | ```sh 26 | curl -X POST http://localhost:9080/books \ 27 | -d 'The Prisoner' \ 28 | -H 'x-user: admin' -v 29 | ``` 30 | 31 | Remove the container 32 | ```shell 33 | docker rm -f lagacy-backend 34 | ``` 35 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/MockedHeaderConfigOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/discovery/api/mocked_api_config.proto 3 | 4 | package org.wso2.choreo.connect.discovery.api; 5 | 6 | public interface MockedHeaderConfigOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:wso2.discovery.api.MockedHeaderConfig) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * string name = 1; 12 | * @return The name. 13 | */ 14 | java.lang.String getName(); 15 | /** 16 | * string name = 1; 17 | * @return The bytes for name. 18 | */ 19 | com.google.protobuf.ByteString 20 | getNameBytes(); 21 | 22 | /** 23 | * string value = 2; 24 | * @return The value. 25 | */ 26 | java.lang.String getValue(); 27 | /** 28 | * string value = 2; 29 | * @return The bytes for value. 30 | */ 31 | com.google.protobuf.ByteString 32 | getValueBytes(); 33 | } 34 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/jwt_generator.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | import "wso2/discovery/config/enforcer/keypair.proto"; 6 | 7 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 8 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 9 | option java_outer_classname = "JWTGeneratorProto"; 10 | option java_multiple_files = true; 11 | 12 | // [#protodoc-title: JWTGenerator] 13 | 14 | // JWT Generator model 15 | message JWTGenerator { 16 | 17 | bool enable = 1; 18 | 19 | string encoding = 2; 20 | 21 | string claim_dialect = 3; 22 | 23 | bool convert_dialect = 4; 24 | 25 | string header = 5; 26 | 27 | string signing_algorithm = 6; 28 | 29 | bool enable_user_claims = 7; 30 | 31 | string gateway_generator_impl = 8; 32 | 33 | string claims_extractor_impl = 9; 34 | 35 | int32 token_ttl = 10; 36 | 37 | repeated Keypair keypairs = 11; 38 | 39 | bool use_kid_property = 12; 40 | } 41 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/customOpaPolicy_v1.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: OPA 3 | parameters: 4 | # following is the only diff with the default OPA policy 5 | requestGenerator: "org.wso2.choreo.connect.tests.CustomOPARequestGenerator" 6 | serverURL: {{ .serverUrl }} 7 | {{- if isParamExists . "accessKey" }} 8 | accessKey: {{ .accessKey }} 9 | {{- end }} 10 | policy: {{ .policy }} 11 | rule: {{ .rule }} 12 | {{- if isParamExists . "sendAccessToken" }} 13 | sendAccessToken: {{ .sendAccessToken }} 14 | {{- end }} 15 | {{- if isParamExists . "additionalProperties" }} 16 | additionalProperties: {{ .additionalProperties }} 17 | {{- end }} 18 | {{- if isParamExists . "maxOpenConnections" }} 19 | maxOpenConnections: {{ .maxOpenConnections }} 20 | {{- end }} 21 | {{- if isParamExists . "maxPerRoute" }} 22 | maxPerRoute: {{ .maxPerRoute }} 23 | {{- end }} 24 | {{- if isParamExists . "connectionTimeout" }} 25 | connectionTimeout: {{ .connectionTimeout }} 26 | {{- end }} 27 | -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/src/main/java/io/swagger/configuration/JacksonConfiguration.java: -------------------------------------------------------------------------------- 1 | package io.swagger.configuration; 2 | 3 | import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; 4 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.threeten.bp.Instant; 8 | import org.threeten.bp.OffsetDateTime; 9 | import org.threeten.bp.ZonedDateTime; 10 | 11 | @Configuration 12 | public class JacksonConfiguration { 13 | 14 | @Bean 15 | @ConditionalOnMissingBean(ThreeTenModule.class) 16 | ThreeTenModule threeTenModule() { 17 | ThreeTenModule module = new ThreeTenModule(); 18 | module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); 19 | module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); 20 | module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); 21 | return module; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/git-artifacts/updated/petstore/Definitions/swagger.yaml: -------------------------------------------------------------------------------- 1 | basePath: /v2 2 | host: mockBackend:2383 3 | info: 4 | title: Swagger Petstore 5 | version: 1.0.6 6 | paths: 7 | /store/inventory: 8 | get: 9 | summary: Find pet by ID 10 | produces: 11 | - application/json 12 | parameters: 13 | - name: petId 14 | in: path 15 | description: ID of pet to return 16 | required: true 17 | type: integer 18 | format: int64 19 | definitions: 20 | Pet: 21 | properties: 22 | id: 23 | format: int64 24 | type: integer 25 | name: 26 | example: doggie 27 | type: string 28 | required: 29 | - name 30 | type: object 31 | schemes: 32 | - http 33 | securityDefinitions: 34 | petstore_auth: 35 | authorizationUrl: https://petstore.swagger.io/oauth/authorize 36 | flow: implicit 37 | scopes: 38 | read:pets: read your pets 39 | write:pets: modify pets in your account 40 | type: oauth2 41 | swagger: "2.0" 42 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/config/enforcer/MetricsOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/discovery/config/enforcer/metrics.proto 3 | 4 | package org.wso2.choreo.connect.discovery.config.enforcer; 5 | 6 | public interface MetricsOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:wso2.discovery.config.enforcer.Metrics) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | *
12 |    * Enable metrics
13 |    * 
14 | * 15 | * bool enabled = 1; 16 | * @return The enabled. 17 | */ 18 | boolean getEnabled(); 19 | 20 | /** 21 | *
22 |    * Exporter Type
23 |    * 
24 | * 25 | * string type = 2; 26 | * @return The type. 27 | */ 28 | java.lang.String getType(); 29 | /** 30 | *
31 |    * Exporter Type
32 |    * 
33 | * 34 | * string type = 2; 35 | * @return The bytes for type. 36 | */ 37 | com.google.protobuf.ByteString 38 | getTypeBytes(); 39 | } 40 | -------------------------------------------------------------------------------- /integration/mock-backend-server/src/main/resources/Dockerfile: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------- 2 | # Copyright (c) 2020, WSO2 Inc. (http://wso2.com) All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # ----------------------------------------------------------------------- 16 | 17 | FROM adoptopenjdk/openjdk11:jre-11.0.14.1_1 18 | 19 | WORKDIR /home/app 20 | 21 | EXPOSE 23823 22 | 23 | COPY maven/ lib/ 24 | COPY schema.graphql /tmp 25 | CMD java -cp "lib/*" org.wso2.choreo.connect.mockbackend.MockServices 26 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/certs/client_certificate.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICojCCAYqgAwIBAgIEZJseMjANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQDDAdh 3 | YmMuY29tMCAXDTIzMDYyNzE3MzY1MFoYDzIxMjMwNjI3MTczNjUwWjASMRAwDgYD 4 | VQQDDAd4eXouY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtdQr 5 | 6+ARkeWfZgwjN80SGExrQpuLwcjoB455vljHyovs5756UNwCCXCroLYHfBq2la6G 6 | /iUgRma5AV63MUXMMsNlGCRWda3/ToMMSSBan9d+VaIfifozHbr5cVqB5UUzCps6 7 | FEeclmamPcnGF4jyHv1JqaP30/nHMAlb6RWtxQrEQ0dwKu4EeOHQZgjbDMP5CCBq 8 | Eqt+zy/S341NjaLLseAR/lete4PKUREZZO8RCQMx9xhWIHt7XdCvqqwn6SwKBPI7 9 | dNFOufREgcFbZqFtF/s/ObKsN4K480sj3yAG0eA/Jbtb4XN2mj4s4GknBeG3wUOT 10 | b1aEw8HJan73dcBx8QIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAbN9UqOgSBVDcU 11 | 60sSU5NLq5SD+IYRTfuELpntU7wuR68EPNC64TavPi6RyeE49kj9xNuF3u6xOIUI 12 | Udo+mZ/h5N1Iw3Toldher4HtjVJ7nooRwQdcLKoHjeEZc7+Y0xhRTCHXXNlJQOj3 13 | HVrgvxrl5CmK0J1vs3wfu8HhMIrpDdbnxeF14CYPWfv7XsrteWHHfZZK7MwDLEB0 14 | GrbPgQu09/ypjQ/3tkvXtGZSI8y4tbZRQ95R/TYhhxADh4OpWN3Ty7txif7+jDJH 15 | Bz0wr0MNTrb634sM2oHKRnrRF3W3jtT3K3XPDZVmkfUWgx8IFwy4OjLNn7/nwQrm 16 | CGB7oIG2 17 | -----END CERTIFICATE----- 18 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/certs/enforcer-truststore-opa-certs/ca.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICnDCCAYQCCQCAlJIW7lHbKjANBgkqhkiG9w0BAQsFADAQMQ4wDAYDVQQDDAVt 3 | eS1jYTAeFw0yMjAzMTIwNjU4MDdaFw0zMjAzMDkwNjU4MDdaMBAxDjAMBgNVBAMM 4 | BW15LWNhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApe4FtluNXGrX 5 | 9Ej/lC+aU+pK8Shv9hWIk7LJ1pxfSQOFrsKa3xGxcMhTnhF1XJKkIQV/E9R2Q37Z 6 | 6ZSKLzppHDSikqFSQQRpsZSwUqq2dXu/hGSHKV9Aaw2CgimzaLqpx2/wnEBtkyDM 7 | A3wA8zV858C+ekjUKqPfI84BIkwbCIGHpeJdIlP/HTc9eJnJsAXPv4inFj03/uNh 8 | YHEDqV2NY4v7YGZRBS6cHSiVr6kzJp7RzB54kgGsFeRNgcVUdS00g/F4Bb89fRhM 9 | yixlfx4ZuJbrWGe2/6qL0hEeGNya1YRI51p/bICd7o1wOSa3szsZ9bnEcKZUY8FM 10 | R0W96EEBHwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQCQjKXR6asApcxNTY0zJm3M 11 | nYmpozz3fZ+ofr+BalgFdETMgL9exy7Ymayih+80XBL/g590vE7bUbrbnll4cMD7 12 | TOzJ5/FORVFQrdmWxv++7GYy1ehB5By6IPnHw9wueC6ZuOtTLyltGhavjqfxMk8g 13 | SO5JtLcC3D7vuR5hJvmWAMmFRTpTj/GqTCIHStIB7V1DNfkQFOq7Qs7O8lOVUpDJ 14 | BS8IuLMQTKH29xZf/7Qc+4TZGylTcdLKv3DGXNqTQpA8+Bdr7hizRte3eswp5Ahp 15 | 6iqAPUQNQv5kksMcM8CpLsdHpV1FZ/D56MhMpfiQdtQCzedhYTbIXaOVyFZRYtnt 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /samples/istio/service-to-service/microservices/trains-service/types.bal: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | public type Train record { 16 | # Id of the schedule item. 17 | string trainId?; 18 | # Number of train carriages. 19 | int numberOfCarriage?; 20 | # Image URL of the train. 21 | string imageURL?; 22 | # Engine model. 23 | string engineModel?; 24 | # Facilities provided in the train. 25 | string facilities?; 26 | }; 27 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/customOpaPolicy_v2.gotmpl: -------------------------------------------------------------------------------- 1 | definition: 2 | action: OPA 3 | parameters: 4 | # following is the only diff with the default OPA policy - this class is not exists 5 | requestGenerator: "org.wso2.choreo.connect.tests.RequestGeneratorNotFound" 6 | serverURL: {{ .serverUrl }} 7 | {{- if isParamExists . "accessKey" }} 8 | accessKey: {{ .accessKey }} 9 | {{- end }} 10 | policy: {{ .policy }} 11 | rule: {{ .rule }} 12 | {{- if isParamExists . "sendAccessToken" }} 13 | sendAccessToken: {{ .sendAccessToken }} 14 | {{- end }} 15 | {{- if isParamExists . "additionalProperties" }} 16 | additionalProperties: {{ .additionalProperties }} 17 | {{- end }} 18 | {{- if isParamExists . "maxOpenConnections" }} 19 | maxOpenConnections: {{ .maxOpenConnections }} 20 | {{- end }} 21 | {{- if isParamExists . "maxPerRoute" }} 22 | maxPerRoute: {{ .maxPerRoute }} 23 | {{- end }} 24 | {{- if isParamExists . "connectionTimeout" }} 25 | connectionTimeout: {{ .connectionTimeout }} 26 | {{- end }} 27 | -------------------------------------------------------------------------------- /resources/adapter/security/truststore/consul/local-dc-client-consul-0.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICpjCCAkygAwIBAgIQIzl4FybvY6NN945INgLYrTAKBggqhkjOPQQDAjCBuTEL 3 | MAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2Nv 4 | MRowGAYDVQQJExExMDEgU2Vjb25kIFN0cmVldDEOMAwGA1UEERMFOTQxMDUxFzAV 5 | BgNVBAoTDkhhc2hpQ29ycCBJbmMuMUAwPgYDVQQDEzdDb25zdWwgQWdlbnQgQ0Eg 6 | MTAxNzkzMjAyOTE3NTQ0MTgwNzUwMjAyMzI0MzkwNTE4ODQzNjcyMB4XDTIxMDEw 7 | NjA5NDEyN1oXDTIyMDEwNjA5NDEyN1owITEfMB0GA1UEAxMWY2xpZW50LmxvY2Fs 8 | LWRjLmNvbnN1bDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABHBiL1uK3uqCtue3 9 | U1o+f/V+JPgmu8ixzioIUFHM+V5xaVgy3k9Kn+BKKehy4Gg6b1jyJzq1rKFwlzRQ 10 | EMtkvWWjgcwwgckwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMC 11 | BggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMCkGA1UdDgQiBCCH5kmYI9qlaRHactVC 12 | XVSpMgKG0HPQwV6rixT2kOpgXzArBgNVHSMEJDAigCC/6kSjhEwHvONTVNLHlXSN 13 | gRTYpPaXCROeLjgQ00lBaTAyBgNVHREEKzApghZjbGllbnQubG9jYWwtZGMuY29u 14 | c3Vsgglsb2NhbGhvc3SHBH8AAAEwCgYIKoZIzj0EAwIDSAAwRQIhALgI1Ae6omC/ 15 | Ya8KvAvUM8HVE/iBB3fXnNM4UJZYxFg1AiBCOYpgDa23VUT8x9VJVuCmCZ02uEzC 16 | luNAt4BWlvADHA== 17 | -----END CERTIFICATE----- 18 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/config/enforcer/ThreadPoolOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/discovery/config/enforcer/thread_pool.proto 3 | 4 | package org.wso2.choreo.connect.discovery.config.enforcer; 5 | 6 | public interface ThreadPoolOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:wso2.discovery.config.enforcer.ThreadPool) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * int32 coreSize = 1; 12 | * @return The coreSize. 13 | */ 14 | int getCoreSize(); 15 | 16 | /** 17 | * int32 maxSize = 2; 18 | * @return The maxSize. 19 | */ 20 | int getMaxSize(); 21 | 22 | /** 23 | *
24 |    * keep alive time of threads in seconds
25 |    * 
26 | * 27 | * int32 keepAliveTime = 3; 28 | * @return The keepAliveTime. 29 | */ 30 | int getKeepAliveTime(); 31 | 32 | /** 33 | * int32 queueSize = 4; 34 | * @return The queueSize. 35 | */ 36 | int getQueueSize(); 37 | } 38 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/config/enforcer/JWTUserOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/discovery/config/enforcer/jwt_user.proto 3 | 4 | package org.wso2.choreo.connect.discovery.config.enforcer; 5 | 6 | public interface JWTUserOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:wso2.discovery.config.enforcer.JWTUser) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * string username = 1; 12 | * @return The username. 13 | */ 14 | java.lang.String getUsername(); 15 | /** 16 | * string username = 1; 17 | * @return The bytes for username. 18 | */ 19 | com.google.protobuf.ByteString 20 | getUsernameBytes(); 21 | 22 | /** 23 | * string password = 2; 24 | * @return The password. 25 | */ 26 | java.lang.String getPassword(); 27 | /** 28 | * string password = 2; 29 | * @return The bytes for password. 30 | */ 31 | com.google.protobuf.ByteString 32 | getPasswordBytes(); 33 | } 34 | -------------------------------------------------------------------------------- /integration/mock-backend-server/src/main/resources/scripts/file-creator-for-test-cases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # -------------------------------------------------------------------- 3 | # Copyright (c) 2022, WSO2 Inc. (http://wso2.com) All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # ----------------------------------------------------------------------- 17 | echo "Copying GraphQL schema file for mock GraphQL server.." 18 | cp ../../samples/apiProjects/SampleGraphQLApi/Definitions/schema.graphql ./src/main/resources 19 | echo "GraphQL schema copied successfully" 20 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/2/subscriptions/subscriptions.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "apiName": "SoapAPI", 4 | "appName": "SoapBasicApp", 5 | "tier": "Unlimited" 6 | }, 7 | { 8 | "apiName": "WebSocketScopeAPI", 9 | "appName": "WebSocketScopeApp", 10 | "tier": "AsyncUnlimited" 11 | }, 12 | { 13 | "apiName": "WebSocketTimeoutAPI", 14 | "appName": "WebSocketTimeoutApp", 15 | "tier": "AsyncUnlimited" 16 | }, 17 | { 18 | "apiName": "KeyTemplateThrottlingAPI", 19 | "appName": "KeyTemplateThrottlingApp", 20 | "tier": "Unlimited" 21 | }, 22 | { 23 | "apiName": "GraphQLBasicAPI", 24 | "appName": "GraphQLBasicApp", 25 | "tier": "Unlimited" 26 | }, 27 | { 28 | "apiName": "GraphQLThrottlingAPI", 29 | "appName": "GraphQLThrottlingApp", 30 | "tier": "Unlimited" 31 | }, 32 | { 33 | "apiName": "GraphQLScopeAPI", 34 | "appName": "GraphQLScopeApp", 35 | "tier": "Unlimited" 36 | }, 37 | { 38 | "apiName": "CompressionTestAPI", 39 | "appName": "CompressionTestApp", 40 | "tier": "Unlimited" 41 | } 42 | ] 43 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/rewriteResourcePath_v1.yaml: -------------------------------------------------------------------------------- 1 | type: operation_policy_specification 2 | version: v4.1.0 3 | data: 4 | category: Mediation 5 | name: rewriteResourcePath 6 | version: v1 7 | displayName: Rewrite Resource Path 8 | description: This policy allows you to rewrite the resource path of a request 9 | applicableFlows: 10 | - request 11 | supportedGateways: 12 | - Synapse 13 | - ChoreoConnect 14 | supportedApiTypes: 15 | - HTTP 16 | policyAttributes: 17 | - 18 | name: newResourcePath 19 | displayName: New Resource Path 20 | description: Name of the new resource path 21 | validationRegex: "^/?([a-zA-Z0-9!@#\\$%\\^\\&*\\)\\(+=._\\-~:,\\?{}/]*)$" 22 | type: String 23 | allowedValues: [] 24 | required: true 25 | - 26 | name: includeQueryParams 27 | displayName: Include Query Parameters? 28 | description: Select whether to include exiting query params to the new resource path 29 | validationRegex: ^(true|false)$ 30 | type: Boolean 31 | allowedValues: [] 32 | defaultValue: "true" 33 | required: false 34 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/policies/opaPolicy_v1.j2: -------------------------------------------------------------------------------- 1 | 2 | {{serverUrl}} 3 | {% if accessToken %} 4 | {{accessKey}} 5 | {% endif %} 6 | {{policy}} 7 | {{rule}} 8 | org.wso2.carbon.apimgt.gateway.opa.APIMOPARequestGenerator 9 | 10 | {% if sendAccessToken %} 11 | {{sendAccessToken}} 12 | {% endif %} 13 | {% if maxOpenConnections %} 14 | {{maxOpenConnections}} 15 | {% endif %} 16 | {% if maxPerRoute %} 17 | {{maxPerRoute}} 18 | {% endif %} 19 | {% if connectionTimeout %} 20 | {{connectionTimeout}} 21 | {% endif %} 22 | {% if additionalProperties %} 23 | {{additionalProperties}} 24 | {% endif %} 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/interceptors/java/spring-server-generated/src/main/java/io/swagger/api/ApiOriginFilter.java: -------------------------------------------------------------------------------- 1 | package io.swagger.api; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.*; 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | @javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2021-11-04T06:10:22.979Z[GMT]") 9 | public class ApiOriginFilter implements Filter { 10 | @Override 11 | public void doFilter(ServletRequest request, ServletResponse response, 12 | FilterChain chain) throws IOException, ServletException { 13 | HttpServletResponse res = (HttpServletResponse) response; 14 | res.addHeader("Access-Control-Allow-Origin", "*"); 15 | res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); 16 | res.addHeader("Access-Control-Allow-Headers", "Content-Type"); 17 | chain.doFilter(request, response); 18 | } 19 | 20 | @Override 21 | public void destroy() { 22 | } 23 | 24 | @Override 25 | public void init(FilterConfig filterConfig) throws ServletException { 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/constants/RouterAccessLogConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.wso2.choreo.connect.enforcer.constants; 20 | 21 | /** 22 | * RouterAccessLogConstants class holds the constants used in Router access logs 23 | */ 24 | public class RouterAccessLogConstants { 25 | public static final String ORIGINAL_PATH_DATA_NAME = "originalPath"; 26 | } 27 | -------------------------------------------------------------------------------- /enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/api/RetryConfigOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: wso2/discovery/api/endpoint_cluster.proto 3 | 4 | package org.wso2.choreo.connect.discovery.api; 5 | 6 | public interface RetryConfigOrBuilder extends 7 | // @@protoc_insertion_point(interface_extends:wso2.discovery.api.RetryConfig) 8 | com.google.protobuf.MessageOrBuilder { 9 | 10 | /** 11 | * uint32 count = 1; 12 | * @return The count. 13 | */ 14 | int getCount(); 15 | 16 | /** 17 | * repeated uint32 statusCodes = 2; 18 | * @return A list containing the statusCodes. 19 | */ 20 | java.util.List getStatusCodesList(); 21 | /** 22 | * repeated uint32 statusCodes = 2; 23 | * @return The count of statusCodes. 24 | */ 25 | int getStatusCodesCount(); 26 | /** 27 | * repeated uint32 statusCodes = 2; 28 | * @param index The index of the element to return. 29 | * @return The statusCodes at the given index. 30 | */ 31 | int getStatusCodes(int index); 32 | } 33 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/resources/apim/1/apis/BackendSecurityAPI.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BackendSecurityAPI", 3 | "version": "1.0.0", 4 | "context": "backend_security", 5 | "type": "HTTP", 6 | "tiersCollection": "Unlimited", 7 | "operationsDTOS": [ 8 | { 9 | "verb": "GET", 10 | "target": "/echo", 11 | "throttlingPolicy": "Unlimited" 12 | }, 13 | { 14 | "verb": "GET", 15 | "target": "/echo2", 16 | "throttlingPolicy": "Unlimited", 17 | "authType": "None" 18 | } 19 | ], 20 | "endpoint": { 21 | "endpoint_type": "http", 22 | "production_endpoints": { 23 | "url": "http://mockBackend:2383/v2" 24 | }, 25 | "sandbox_endpoints": { 26 | "url": "http://mockBackend:2390/v2" 27 | }, 28 | "endpoint_security": { 29 | "production": { 30 | "type": "BASIC", 31 | "username": "admin", 32 | "password": "admin", 33 | "enabled": true 34 | }, 35 | "sandbox": { 36 | "type": "BASIC", 37 | "username": "admin", 38 | "password": "admin", 39 | "enabled": true 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /samples/interceptors/nodejs/nodejs-interceptor-server-generated/utils/writer.js: -------------------------------------------------------------------------------- 1 | var ResponsePayload = function(code, payload) { 2 | this.code = code; 3 | this.payload = payload; 4 | } 5 | 6 | exports.respondWithCode = function(code, payload) { 7 | return new ResponsePayload(code, payload); 8 | } 9 | 10 | var writeJson = exports.writeJson = function(response, arg1, arg2) { 11 | var code; 12 | var payload; 13 | 14 | if(arg1 && arg1 instanceof ResponsePayload) { 15 | writeJson(response, arg1.payload, arg1.code); 16 | return; 17 | } 18 | 19 | if(arg2 && Number.isInteger(arg2)) { 20 | code = arg2; 21 | } 22 | else { 23 | if(arg1 && Number.isInteger(arg1)) { 24 | code = arg1; 25 | } 26 | } 27 | if(code && arg1) { 28 | payload = arg1; 29 | } 30 | else if(arg1) { 31 | payload = arg1; 32 | } 33 | 34 | if(!code) { 35 | // if no response code given, we default to 200 36 | code = 200; 37 | } 38 | if(typeof payload === 'object') { 39 | payload = JSON.stringify(payload, null, 2); 40 | } 41 | response.writeHead(code, {'Content-Type': 'application/json'}); 42 | response.end(payload); 43 | } 44 | -------------------------------------------------------------------------------- /api/proto/wso2/discovery/config/enforcer/throttle_agent.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package wso2.discovery.config.enforcer; 4 | 5 | option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer"; 6 | option java_package = "org.wso2.choreo.connect.discovery.config.enforcer"; 7 | option java_outer_classname = "ThrottleAgentProto"; 8 | option java_multiple_files = true; 9 | 10 | // [#protodoc-title: ThrottleAgent] 11 | 12 | // Throttle Agent configuration model 13 | message ThrottleAgent { 14 | string sslEnabledProtocols = 1; 15 | string ciphers = 2; 16 | int32 queueSize = 3; 17 | int32 batchSize = 4; 18 | int32 corePoolSize = 5; 19 | int32 socketTimeoutMS = 6; 20 | int32 maxPoolSize = 7; 21 | int32 keepAliveTimeInPool = 8; 22 | int32 reconnectionInterval = 9; 23 | int32 maxTransportPoolSize = 10; 24 | int32 maxIdleConnections = 11; 25 | int32 evictionTimePeriod = 12; 26 | int32 minIdleTimeInPool = 13; 27 | int32 secureMaxTransportPoolSize = 14; 28 | int32 secureMaxIdleConnections = 15; 29 | int32 secureEvictionTimePeriod = 16; 30 | int32 secureMinIdleTimeInPool = 17; 31 | } 32 | -------------------------------------------------------------------------------- /integration/test-integration/src/test/java/org/wso2/choreo/connect/tests/context/ChoreoConnect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. 3 | * 4 | * WSO2 Inc. licenses this file to you under the Apache License, 5 | * Version 2.0 (the "License"); you may not use this file except 6 | * in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | * KIND, either express or implied. See the License for the 15 | * specific language governing permissions and limitations 16 | * under the License. 17 | */ 18 | 19 | package org.wso2.choreo.connect.tests.context; 20 | 21 | import java.io.IOException; 22 | 23 | /** 24 | * Interface for Choreo Connect instance implementation 25 | */ 26 | public interface ChoreoConnect { 27 | 28 | void start() throws IOException, InterruptedException, CCTestException; 29 | 30 | void stop(); 31 | } 32 | -------------------------------------------------------------------------------- /resources/license/LICENSE-ROUTER.txt: -------------------------------------------------------------------------------- 1 | 2 | This product is licensed by WSO2 LLC. under Apache License 2.0. The license 3 | can be downloaded from the following locations: 4 | http://www.apache.org/licenses/LICENSE-2.0.html 5 | http://www.apache.org/licenses/LICENSE-2.0.txt 6 | 7 | This product also contains software under different licenses. This table below 8 | all the contained libraries (jar files) and the license under which they are 9 | provided to you. 10 | 11 | At the bottom of this file is a table that shows what each license indicated 12 | below is and where the actual text of the license can be found. 13 | 14 | 15 | Dependency Version License 16 | ------------------------------------------------------------------------------------------------------------- 17 | https://github.com/proxy-wasm/proxy-wasm-cpp-sdk c32d380ca6c9b1afac38a3841be99c37af2698bf apache2 18 | 19 | The license types used by the above libraries and their information is given below: 20 | 21 | apache2 Apache License Version 2.0 22 | http://www.apache.org/licenses/LICENSE-2.0.html 23 | --------------------------------------------------------------------------------