Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix subscription validation #1999

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions adapter/api/proto/wso2/discovery/config/enforcer/client.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
//
// WSO2 LLC. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

syntax = "proto3";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

License Header?


package wso2.discovery.config.enforcer;

option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer";
option java_package = "org.wso2.apk.enforcer.discovery.config.enforcer";
option java_outer_classname = "HttpClientProto";
option java_multiple_files = true;

// [#protodoc-title: SSL]

// Model for enforcer management user
message HttpClient {
// Disable SSL Verification
bool skipSSl = 1;

// Hostname Verifier
string hostnameVerifier = 2;

// MaxtotalConnections
int32 maxTotalConnections = 3;
// MaxConnectionsPerRoute
int32 maxConnectionsPerRoute = 4;
// ConnectTimeout
int32 connectTimeout = 5;
// SocketTimeout
int32 socketTimeout = 6;

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import "wso2/discovery/config/enforcer/filter.proto";
import "wso2/discovery/config/enforcer/tracing.proto";
import "wso2/discovery/config/enforcer/metrics.proto";
import "wso2/discovery/config/enforcer/soap.proto";

import "wso2/discovery/config/enforcer/client.proto";
option go_package = "github.com/envoyproxy/go-control-plane/wso2/discovery/config/enforcer;enforcer";
option java_package = "org.wso2.apk.enforcer.discovery.config.enforcer";
option java_outer_classname = "ConfigProto";
Expand Down Expand Up @@ -48,4 +48,6 @@ message Config {
Soap soap = 12;

bool mandateSubscriptionValidation = 13;

HttpClient httpClient = 14;
}
8 changes: 8 additions & 0 deletions adapter/config/default_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ var defaultConfig = &Config{
Username: "admin",
Password: "admin",
},
Client: httpClient{
SkipSSL: false,
HostnameVerifier: "BROWSER_COMPATIBLE",
MaxTotalConnectins: 100,
MaxPerHostConnectins: 10,
ConnectionTimeout: 10000,
SocketTimeout: 10000,
},
Security: security{
APIkey: apiKey{
Enabled: true,
Expand Down
8 changes: 7 additions & 1 deletion adapter/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ type enforcer struct {
Filters []filter
Metrics metrics
MandateSubscriptionValidation bool
Client httpClient
}

type consul struct {
Expand Down Expand Up @@ -411,7 +412,12 @@ type filter struct {
}

type httpClient struct {
RequestTimeOut time.Duration
SkipSSL bool
HostnameVerifier string
MaxTotalConnectins int
MaxPerHostConnectins int
ConnectionTimeout time.Duration
SocketTimeout time.Duration
}

type mutualSSL struct {
Expand Down
9 changes: 9 additions & 0 deletions adapter/internal/discovery/xds/marshaller.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ func MarshalConfig(config *config.Config) *enforcer.Config {
}
filters = append(filters, filter)
}
httpClient := &enforcer.HttpClient{
SkipSSl: config.Enforcer.Client.SkipSSL,
HostnameVerifier: config.Enforcer.Client.HostnameVerifier,
MaxTotalConnections: int32(config.Enforcer.Client.MaxTotalConnectins),
MaxConnectionsPerRoute: int32(config.Enforcer.Client.MaxPerHostConnectins),
ConnectTimeout: int32(config.Enforcer.Client.ConnectionTimeout),
SocketTimeout: int32(config.Enforcer.Client.SocketTimeout),
}

return &enforcer.Config{
JwtGenerator: &enforcer.JWTGenerator{
Expand Down Expand Up @@ -151,6 +159,7 @@ func MarshalConfig(config *config.Config) *enforcer.Config {
Filters: filters,
Soap: soap,
MandateSubscriptionValidation: mandateSubscriptionValidation,
HttpClient: httpClient,
}
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading