{
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 |
--------------------------------------------------------------------------------