From 21dba6c4ad45bec9091e30f90297343c4fe2f6fb Mon Sep 17 00:00:00 2001 From: tharindu1st Date: Sun, 11 Feb 2024 12:20:30 +0530 Subject: [PATCH 1/2] support httpclient --- .../discovery/config/enforcer/client.proto | 29 + .../discovery/config/enforcer/config.proto | 4 +- adapter/config/default_config.go | 8 + adapter/config/types.go | 8 +- adapter/internal/discovery/xds/marshaller.go | 9 + .../discovery/config/enforcer/client.pb.go | 215 ++++ .../discovery/config/enforcer/config.pb.go | 157 +-- .../internal/config/default_config.go | 2 +- .../controlplane/controlplane_client.go | 20 +- .../controlplane/k8s_artifact_deployer.go | 6 + .../internal/controlplane/types.go | 25 +- .../apk/enforcer/config/ConfigHolder.java | 15 + .../apk/enforcer/config/EnforcerConfig.java | 12 + .../enforcer/config/dto/ClientConfigDto.java | 91 ++ .../discovery/config/enforcer/Config.java | 188 ++++ .../config/enforcer/ConfigOrBuilder.java | 15 + .../config/enforcer/ConfigProto.java | 55 +- .../discovery/config/enforcer/HttpClient.java | 994 ++++++++++++++++++ .../config/enforcer/HttpClientOrBuilder.java | 79 ++ .../config/enforcer/HttpClientProto.java | 56 + .../service/apkmgt/EventServiceProto.java | 8 +- .../ApplicationKeyMappingProto.java | 8 +- .../subscription/ApplicationMappingProto.java | 8 +- .../subscription/ApplicationProto.java | 9 +- .../discovery/subscription/EventProto.java | 8 +- .../subscription/SubscriptionProto.java | 8 +- .../wso2/apk/enforcer/util/FilterUtils.java | 45 +- 27 files changed, 1913 insertions(+), 169 deletions(-) create mode 100644 adapter/api/proto/wso2/discovery/config/enforcer/client.proto create mode 100644 adapter/pkg/discovery/api/wso2/discovery/config/enforcer/client.pb.go create mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/dto/ClientConfigDto.java create mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClient.java create mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClientOrBuilder.java create mode 100644 gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClientProto.java diff --git a/adapter/api/proto/wso2/discovery/config/enforcer/client.proto b/adapter/api/proto/wso2/discovery/config/enforcer/client.proto new file mode 100644 index 000000000..a7023f4cb --- /dev/null +++ b/adapter/api/proto/wso2/discovery/config/enforcer/client.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +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; + +} diff --git a/adapter/api/proto/wso2/discovery/config/enforcer/config.proto b/adapter/api/proto/wso2/discovery/config/enforcer/config.proto index 131f08fd1..e2b91213e 100644 --- a/adapter/api/proto/wso2/discovery/config/enforcer/config.proto +++ b/adapter/api/proto/wso2/discovery/config/enforcer/config.proto @@ -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"; @@ -48,4 +48,6 @@ message Config { Soap soap = 12; bool mandateSubscriptionValidation = 13; + + HttpClient httpClient = 14; } diff --git a/adapter/config/default_config.go b/adapter/config/default_config.go index 3b3200b0d..df213701c 100644 --- a/adapter/config/default_config.go +++ b/adapter/config/default_config.go @@ -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, diff --git a/adapter/config/types.go b/adapter/config/types.go index 14b6e8e4b..5741dab3e 100644 --- a/adapter/config/types.go +++ b/adapter/config/types.go @@ -160,6 +160,7 @@ type enforcer struct { Filters []filter Metrics metrics MandateSubscriptionValidation bool + Client httpClient } type consul struct { @@ -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 { diff --git a/adapter/internal/discovery/xds/marshaller.go b/adapter/internal/discovery/xds/marshaller.go index f9430295b..d36cee776 100644 --- a/adapter/internal/discovery/xds/marshaller.go +++ b/adapter/internal/discovery/xds/marshaller.go @@ -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{ @@ -151,6 +159,7 @@ func MarshalConfig(config *config.Config) *enforcer.Config { Filters: filters, Soap: soap, MandateSubscriptionValidation: mandateSubscriptionValidation, + HttpClient: httpClient, } } diff --git a/adapter/pkg/discovery/api/wso2/discovery/config/enforcer/client.pb.go b/adapter/pkg/discovery/api/wso2/discovery/config/enforcer/client.pb.go new file mode 100644 index 000000000..b022f637c --- /dev/null +++ b/adapter/pkg/discovery/api/wso2/discovery/config/enforcer/client.pb.go @@ -0,0 +1,215 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0-devel +// protoc v3.13.0 +// source: wso2/discovery/config/enforcer/client.proto + +package enforcer + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Model for enforcer management user +type HttpClient struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Disable SSL Verification + SkipSSl bool `protobuf:"varint,1,opt,name=skipSSl,proto3" json:"skipSSl,omitempty"` + // Hostname Verifier + HostnameVerifier string `protobuf:"bytes,2,opt,name=hostnameVerifier,proto3" json:"hostnameVerifier,omitempty"` + // MaxtotalConnections + MaxTotalConnections int32 `protobuf:"varint,3,opt,name=maxTotalConnections,proto3" json:"maxTotalConnections,omitempty"` + // MaxConnectionsPerRoute + MaxConnectionsPerRoute int32 `protobuf:"varint,4,opt,name=maxConnectionsPerRoute,proto3" json:"maxConnectionsPerRoute,omitempty"` + // ConnectTimeout + ConnectTimeout int32 `protobuf:"varint,5,opt,name=connectTimeout,proto3" json:"connectTimeout,omitempty"` + // SocketTimeout + SocketTimeout int32 `protobuf:"varint,6,opt,name=socketTimeout,proto3" json:"socketTimeout,omitempty"` +} + +func (x *HttpClient) Reset() { + *x = HttpClient{} + if protoimpl.UnsafeEnabled { + mi := &file_wso2_discovery_config_enforcer_client_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HttpClient) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HttpClient) ProtoMessage() {} + +func (x *HttpClient) ProtoReflect() protoreflect.Message { + mi := &file_wso2_discovery_config_enforcer_client_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HttpClient.ProtoReflect.Descriptor instead. +func (*HttpClient) Descriptor() ([]byte, []int) { + return file_wso2_discovery_config_enforcer_client_proto_rawDescGZIP(), []int{0} +} + +func (x *HttpClient) GetSkipSSl() bool { + if x != nil { + return x.SkipSSl + } + return false +} + +func (x *HttpClient) GetHostnameVerifier() string { + if x != nil { + return x.HostnameVerifier + } + return "" +} + +func (x *HttpClient) GetMaxTotalConnections() int32 { + if x != nil { + return x.MaxTotalConnections + } + return 0 +} + +func (x *HttpClient) GetMaxConnectionsPerRoute() int32 { + if x != nil { + return x.MaxConnectionsPerRoute + } + return 0 +} + +func (x *HttpClient) GetConnectTimeout() int32 { + if x != nil { + return x.ConnectTimeout + } + return 0 +} + +func (x *HttpClient) GetSocketTimeout() int32 { + if x != nil { + return x.SocketTimeout + } + return 0 +} + +var File_wso2_discovery_config_enforcer_client_proto protoreflect.FileDescriptor + +var file_wso2_discovery_config_enforcer_client_proto_rawDesc = []byte{ + 0x0a, 0x2b, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, + 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, + 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x77, + 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x22, 0x8a, 0x02, + 0x0a, 0x0a, 0x48, 0x74, 0x74, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, + 0x73, 0x6b, 0x69, 0x70, 0x53, 0x53, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, + 0x6b, 0x69, 0x70, 0x53, 0x53, 0x6c, 0x12, 0x2a, 0x0a, 0x10, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, + 0x6d, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x10, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x65, 0x72, 0x12, 0x30, 0x0a, 0x13, 0x6d, 0x61, 0x78, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x13, 0x6d, 0x61, 0x78, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x36, 0x0a, 0x16, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x65, 0x72, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x16, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x65, 0x72, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x26, 0x0a, 0x0e, + 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x54, 0x69, 0x6d, + 0x65, 0x6f, 0x75, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x73, 0x6f, 0x63, + 0x6b, 0x65, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x42, 0x94, 0x01, 0x0a, 0x2f, 0x6f, + 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x61, 0x70, 0x6b, 0x2e, 0x65, 0x6e, 0x66, 0x6f, + 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x42, 0x0f, + 0x48, 0x74, 0x74, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x4e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, + 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, + 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x3b, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, + 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_wso2_discovery_config_enforcer_client_proto_rawDescOnce sync.Once + file_wso2_discovery_config_enforcer_client_proto_rawDescData = file_wso2_discovery_config_enforcer_client_proto_rawDesc +) + +func file_wso2_discovery_config_enforcer_client_proto_rawDescGZIP() []byte { + file_wso2_discovery_config_enforcer_client_proto_rawDescOnce.Do(func() { + file_wso2_discovery_config_enforcer_client_proto_rawDescData = protoimpl.X.CompressGZIP(file_wso2_discovery_config_enforcer_client_proto_rawDescData) + }) + return file_wso2_discovery_config_enforcer_client_proto_rawDescData +} + +var file_wso2_discovery_config_enforcer_client_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_wso2_discovery_config_enforcer_client_proto_goTypes = []interface{}{ + (*HttpClient)(nil), // 0: wso2.discovery.config.enforcer.HttpClient +} +var file_wso2_discovery_config_enforcer_client_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_wso2_discovery_config_enforcer_client_proto_init() } +func file_wso2_discovery_config_enforcer_client_proto_init() { + if File_wso2_discovery_config_enforcer_client_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_wso2_discovery_config_enforcer_client_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HttpClient); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_wso2_discovery_config_enforcer_client_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_wso2_discovery_config_enforcer_client_proto_goTypes, + DependencyIndexes: file_wso2_discovery_config_enforcer_client_proto_depIdxs, + MessageInfos: file_wso2_discovery_config_enforcer_client_proto_msgTypes, + }.Build() + File_wso2_discovery_config_enforcer_client_proto = out.File + file_wso2_discovery_config_enforcer_client_proto_rawDesc = nil + file_wso2_discovery_config_enforcer_client_proto_goTypes = nil + file_wso2_discovery_config_enforcer_client_proto_depIdxs = nil +} diff --git a/adapter/pkg/discovery/api/wso2/discovery/config/enforcer/config.pb.go b/adapter/pkg/discovery/api/wso2/discovery/config/enforcer/config.pb.go index 372f0d886..7acd2de17 100644 --- a/adapter/pkg/discovery/api/wso2/discovery/config/enforcer/config.pb.go +++ b/adapter/pkg/discovery/api/wso2/discovery/config/enforcer/config.pb.go @@ -39,6 +39,7 @@ type Config struct { Filters []*Filter `protobuf:"bytes,11,rep,name=filters,proto3" json:"filters,omitempty"` Soap *Soap `protobuf:"bytes,12,opt,name=soap,proto3" json:"soap,omitempty"` MandateSubscriptionValidation bool `protobuf:"varint,13,opt,name=mandateSubscriptionValidation,proto3" json:"mandateSubscriptionValidation,omitempty"` + HttpClient *HttpClient `protobuf:"bytes,14,opt,name=httpClient,proto3" json:"httpClient,omitempty"` } func (x *Config) Reset() { @@ -164,6 +165,13 @@ func (x *Config) GetMandateSubscriptionValidation() bool { return false } +func (x *Config) GetHttpClient() *HttpClient { + if x != nil { + return x.HttpClient + } + return nil +} + var File_wso2_discovery_config_enforcer_config_proto protoreflect.FileDescriptor var file_wso2_discovery_config_enforcer_config_proto_rawDesc = []byte{ @@ -203,74 +211,82 @@ var file_wso2_discovery_config_enforcer_config_proto_rawDesc = []byte{ 0x72, 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2f, - 0x73, 0x6f, 0x61, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x97, 0x07, 0x0a, 0x06, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x44, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, - 0x79, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x45, 0x0a, 0x08, 0x6b, - 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, - 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x43, - 0x65, 0x72, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, - 0x72, 0x65, 0x12, 0x49, 0x0a, 0x0a, 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, + 0x73, 0x6f, 0x61, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2b, 0x77, 0x73, 0x6f, 0x32, + 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe3, 0x07, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x44, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, + 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, + 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, + 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x45, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x73, + 0x74, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x77, 0x73, 0x6f, + 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x43, 0x65, 0x72, 0x74, + 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, + 0x49, 0x0a, 0x0a, 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, + 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, + 0x72, 0x63, 0x65, 0x72, 0x2e, 0x43, 0x65, 0x72, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x52, 0x0a, + 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x49, 0x0a, 0x0b, 0x61, 0x75, + 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, + 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, + 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x0c, 0x6a, 0x77, 0x74, 0x47, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x77, 0x73, + 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x4a, 0x57, 0x54, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0c, 0x6a, 0x77, 0x74, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x3b, 0x0a, 0x05, 0x63, 0x61, 0x63, 0x68, 0x65, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, - 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x43, 0x65, 0x72, 0x74, 0x53, 0x74, 0x6f, 0x72, - 0x65, 0x52, 0x0a, 0x74, 0x72, 0x75, 0x73, 0x74, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x49, 0x0a, - 0x0b, 0x61, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, - 0x63, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x0b, 0x61, 0x75, 0x74, - 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x0c, 0x6a, 0x77, 0x74, 0x47, - 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, - 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, - 0x4a, 0x57, 0x54, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0c, 0x6a, 0x77, - 0x74, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x3b, 0x0a, 0x05, 0x63, 0x61, - 0x63, 0x68, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x77, 0x73, 0x6f, 0x32, - 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x43, 0x61, 0x63, 0x68, 0x65, - 0x52, 0x05, 0x63, 0x61, 0x63, 0x68, 0x65, 0x12, 0x47, 0x0a, 0x09, 0x61, 0x6e, 0x61, 0x6c, 0x79, - 0x74, 0x69, 0x63, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x77, 0x73, 0x6f, + 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x05, 0x63, + 0x61, 0x63, 0x68, 0x65, 0x12, 0x47, 0x0a, 0x09, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, + 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, + 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, + 0x63, 0x73, 0x52, 0x09, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, 0x12, 0x4a, 0x0a, + 0x0a, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2a, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, + 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, + 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0a, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x07, 0x74, 0x72, 0x61, + 0x63, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x41, 0x6e, 0x61, 0x6c, - 0x79, 0x74, 0x69, 0x63, 0x73, 0x52, 0x09, 0x61, 0x6e, 0x61, 0x6c, 0x79, 0x74, 0x69, 0x63, 0x73, - 0x12, 0x4a, 0x0a, 0x0a, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, - 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, - 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x0a, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x07, - 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, + 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x54, 0x72, 0x61, 0x63, + 0x69, 0x6e, 0x67, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x41, 0x0a, 0x07, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x54, - 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x12, - 0x41, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x27, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, + 0x40, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, - 0x72, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x73, 0x12, 0x40, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0b, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, - 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, - 0x72, 0x63, 0x65, 0x72, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x73, 0x12, 0x38, 0x0a, 0x04, 0x73, 0x6f, 0x61, 0x70, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, - 0x63, 0x65, 0x72, 0x2e, 0x53, 0x6f, 0x61, 0x70, 0x52, 0x04, 0x73, 0x6f, 0x61, 0x70, 0x12, 0x44, - 0x0a, 0x1d, 0x6d, 0x61, 0x6e, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1d, 0x6d, 0x61, 0x6e, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x90, 0x01, 0x0a, 0x2f, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, - 0x32, 0x2e, 0x61, 0x70, 0x6b, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, - 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x42, 0x0b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, - 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, - 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x3b, 0x65, - 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x73, 0x12, 0x38, 0x0a, 0x04, 0x73, 0x6f, 0x61, 0x70, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, + 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, + 0x2e, 0x53, 0x6f, 0x61, 0x70, 0x52, 0x04, 0x73, 0x6f, 0x61, 0x70, 0x12, 0x44, 0x0a, 0x1d, 0x6d, + 0x61, 0x6e, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0d, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x1d, 0x6d, 0x61, 0x6e, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x4a, 0x0a, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x18, + 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, + 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x52, 0x0a, 0x68, 0x74, 0x74, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x42, 0x90, 0x01, + 0x0a, 0x2f, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x61, 0x70, 0x6b, 0x2e, 0x65, + 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, + 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, + 0x72, 0x42, 0x0b, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x4e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, + 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x65, + 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x3b, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -299,6 +315,7 @@ var file_wso2_discovery_config_enforcer_config_proto_goTypes = []interface{}{ (*Metrics)(nil), // 9: wso2.discovery.config.enforcer.Metrics (*Filter)(nil), // 10: wso2.discovery.config.enforcer.Filter (*Soap)(nil), // 11: wso2.discovery.config.enforcer.Soap + (*HttpClient)(nil), // 12: wso2.discovery.config.enforcer.HttpClient } var file_wso2_discovery_config_enforcer_config_proto_depIdxs = []int32{ 1, // 0: wso2.discovery.config.enforcer.Config.security:type_name -> wso2.discovery.config.enforcer.Security @@ -313,11 +330,12 @@ var file_wso2_discovery_config_enforcer_config_proto_depIdxs = []int32{ 9, // 9: wso2.discovery.config.enforcer.Config.metrics:type_name -> wso2.discovery.config.enforcer.Metrics 10, // 10: wso2.discovery.config.enforcer.Config.filters:type_name -> wso2.discovery.config.enforcer.Filter 11, // 11: wso2.discovery.config.enforcer.Config.soap:type_name -> wso2.discovery.config.enforcer.Soap - 12, // [12:12] is the sub-list for method output_type - 12, // [12:12] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 12, // 12: wso2.discovery.config.enforcer.Config.httpClient:type_name -> wso2.discovery.config.enforcer.HttpClient + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_wso2_discovery_config_enforcer_config_proto_init() } @@ -336,6 +354,7 @@ func file_wso2_discovery_config_enforcer_config_proto_init() { file_wso2_discovery_config_enforcer_tracing_proto_init() file_wso2_discovery_config_enforcer_metrics_proto_init() file_wso2_discovery_config_enforcer_soap_proto_init() + file_wso2_discovery_config_enforcer_client_proto_init() if !protoimpl.UnsafeEnabled { file_wso2_discovery_config_enforcer_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Config); i { diff --git a/common-controller/internal/config/default_config.go b/common-controller/internal/config/default_config.go index 081122c36..3097ba8d2 100644 --- a/common-controller/internal/config/default_config.go +++ b/common-controller/internal/config/default_config.go @@ -36,7 +36,7 @@ var defaultConfig = &Config{ Environment: "Default", InternalAPIServer: internalAPIServer{Port: 18003}, ControlPlane: controlplane{ - Enabled: false, + Enabled: true, Host: "localhost", EventPort: 18000, RestPort: 18001, diff --git a/common-controller/internal/controlplane/controlplane_client.go b/common-controller/internal/controlplane/controlplane_client.go index cddf09833..bbc2c18ff 100644 --- a/common-controller/internal/controlplane/controlplane_client.go +++ b/common-controller/internal/controlplane/controlplane_client.go @@ -55,7 +55,6 @@ type Agent struct { var ( subsriptionList *SubscriptionList applicationList *ApplicationList - appKeyMappingList *ApplicationKeyMappingList appMappingList *ApplicationMappingList connectionFaultChannel chan bool eventStreamingClient apkmgt.EventStreamService_StreamEventsClient @@ -68,10 +67,6 @@ var ( endpoint: "/applications", responseType: applicationList, }, - { - endpoint: "/applicationkeymappings", - responseType: appKeyMappingList, - }, {endpoint: "/applicationmappings", responseType: appMappingList, }, @@ -440,11 +435,8 @@ func (controlPlaneGrpcClient *Agent) retrieveDataFromResponseChannel(response re loggers.LoggerAPI.Infof("Received Application information.") appList := newResponse.(*ApplicationList) resolvedApplicationList := marshalMultipleApplications(appList) + resolvedApplicationKeyMappingList := marshalMultipleApplicationKeyMappings(appList) controlPlaneGrpcClient.artifactDeployer.DeployAllApplications(resolvedApplicationList) - case *ApplicationKeyMappingList: - loggers.LoggerAPI.Infof("Received Application Key Mapping information.") - appKeyMappingList := newResponse.(*ApplicationKeyMappingList) - resolvedApplicationKeyMappingList := marshalMultipleApplicationKeyMappings(appKeyMappingList) controlPlaneGrpcClient.artifactDeployer.DeployAllKeyMappings(resolvedApplicationKeyMappingList) case *ApplicationMappingList: loggers.LoggerAPI.Infof("Received Application Mapping information.") @@ -472,11 +464,13 @@ func marshalMultipleApplications(appList *ApplicationList) server.ApplicationLis } return applicationList } -func marshalMultipleApplicationKeyMappings(appKeyMappingList *ApplicationKeyMappingList) server.ApplicationKeyMappingList { +func marshalMultipleApplicationKeyMappings(appList *ApplicationList) server.ApplicationKeyMappingList { applicationKeyMappingList := server.ApplicationKeyMappingList{List: []server.ApplicationKeyMapping{}} - for _, applicationKeyMapping := range appKeyMappingList.List { - loggers.LoggerAPI.Debugf("ApplicationKeyMapping: %v", applicationKeyMapping) - applicationKeyMappingList.List = append(applicationKeyMappingList.List, server.ApplicationKeyMapping{ApplicationUUID: applicationKeyMapping.ApplicationUUID, SecurityScheme: applicationKeyMapping.SecurityScheme, ApplicationIdentifier: applicationKeyMapping.ApplicationIdentifier, KeyType: applicationKeyMapping.KeyType, EnvID: applicationKeyMapping.EnvID, OrganizationID: applicationKeyMapping.Organization}) + for _, application := range appList.List { + loggers.LoggerAPI.Debugf("Application: %v", application) + for _, securityScheme := range application.SecuritySchemes { + applicationKeyMappingList.List = append(applicationKeyMappingList.List, server.ApplicationKeyMapping{ApplicationUUID: application.UUID, SecurityScheme: securityScheme.SecurityScheme, ApplicationIdentifier: securityScheme.ApplicationIdentifier, KeyType: securityScheme.KeyType, EnvID: securityScheme.EnvID, OrganizationID: application.Organization}) + } } return applicationKeyMappingList } diff --git a/common-controller/internal/controlplane/k8s_artifact_deployer.go b/common-controller/internal/controlplane/k8s_artifact_deployer.go index d5f61f185..54ca8ee0b 100644 --- a/common-controller/internal/controlplane/k8s_artifact_deployer.go +++ b/common-controller/internal/controlplane/k8s_artifact_deployer.go @@ -395,6 +395,12 @@ func (k8sArtifactDeployer K8sArtifactDeployer) DeployAllApplications(application // DeployAllKeyMappings deploys all key mappings func (k8sArtifactDeployer K8sArtifactDeployer) DeployAllKeyMappings(keyMappings server.ApplicationKeyMappingList) error { + for _, keyMapping := range keyMappings.List { + err := k8sArtifactDeployer.DeployKeyMappings(keyMapping) + if err != nil { + return err + } + } return nil } diff --git a/common-controller/internal/controlplane/types.go b/common-controller/internal/controlplane/types.go index da9a987ff..ff3531d5d 100644 --- a/common-controller/internal/controlplane/types.go +++ b/common-controller/internal/controlplane/types.go @@ -39,12 +39,13 @@ type SubscribedAPI struct { // Application for struct application type Application struct { - UUID string `json:"uuid,omitempty"` - Name string `json:"name,omitempty"` - Owner string `json:"owner,omitempty"` - Organization string `json:"organization,omitempty"` - Attributes map[string]string `json:"attributes,omitempty"` - TimeStamp int64 `json:"timeStamp,omitempty"` + UUID string `json:"uuid,omitempty"` + Name string `json:"name,omitempty"` + Owner string `json:"owner,omitempty"` + Organization string `json:"organization,omitempty"` + Attributes map[string]string `json:"attributes,omitempty"` + TimeStamp int64 `json:"timeStamp,omitempty"` + SecuritySchemes []SecurityScheme `json:"securitySchemes,omitempty"` } // ApplicationList for struct list of application @@ -52,20 +53,12 @@ type ApplicationList struct { List []Application `json:"list"` } -// ApplicationKeyMapping for struct applicationKeyMapping -type ApplicationKeyMapping struct { - ApplicationUUID string `json:"applicationUUID,omitempty"` +// SecurityScheme for struct securityScheme +type SecurityScheme struct { SecurityScheme string `json:"securityScheme,omitempty"` ApplicationIdentifier string `json:"applicationIdentifier,omitempty"` KeyType string `json:"keyType,omitempty"` EnvID string `json:"envID,omitempty"` - Timestamp int64 `json:"timestamp,omitempty"` - Organization string `json:"organization,omitempty"` -} - -// ApplicationKeyMappingList for struct list of applicationKeyMapping -type ApplicationKeyMappingList struct { - List []ApplicationKeyMapping `json:"list"` } // ApplicationMapping for struct applicationMapping diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/ConfigHolder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/ConfigHolder.java index 4c53888ae..8f424d888 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/ConfigHolder.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/ConfigHolder.java @@ -35,6 +35,7 @@ import org.wso2.apk.enforcer.config.dto.AnalyticsReceiverConfigDTO; import org.wso2.apk.enforcer.config.dto.AuthServiceConfigurationDto; import org.wso2.apk.enforcer.config.dto.CacheDto; +import org.wso2.apk.enforcer.config.dto.ClientConfigDto; import org.wso2.apk.enforcer.config.dto.FilterDTO; import org.wso2.apk.enforcer.config.dto.ManagementCredentialsDto; import org.wso2.apk.enforcer.config.dto.MetricsDTO; @@ -50,6 +51,7 @@ import org.wso2.apk.enforcer.discovery.config.enforcer.Cache; import org.wso2.apk.enforcer.discovery.config.enforcer.Config; import org.wso2.apk.enforcer.discovery.config.enforcer.Filter; +import org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient; import org.wso2.apk.enforcer.discovery.config.enforcer.JWTGenerator; import org.wso2.apk.enforcer.discovery.config.enforcer.Keypair; import org.wso2.apk.enforcer.discovery.config.enforcer.Management; @@ -171,10 +173,23 @@ private void parseConfigs(Config config) { populateAPIKeyIssuer(config.getSecurity().getApiKey()); populateInternalTokenIssuer(config.getSecurity().getRuntimeToken()); populateMandateSubscriptionValidationConfig(config.getMandateSubscriptionValidation()); + populateHttpClientConfig(config.getHttpClient()); // resolve string variables provided as environment variables. resolveConfigsWithEnvs(this.config); } + private void populateHttpClientConfig(HttpClient httpClient) { + + ClientConfigDto clientConfigDto = new ClientConfigDto(); + clientConfigDto.setEnableSslVerification(httpClient.getSkipSSl()); + clientConfigDto.setHostnameVerifier(httpClient.getHostnameVerifier()); + clientConfigDto.setConnectionTimeout(httpClient.getConnectTimeout()); + clientConfigDto.setSocketTimeout(httpClient.getSocketTimeout()); + clientConfigDto.setMaxConnections(httpClient.getMaxTotalConnections()); + clientConfigDto.setMaxConnectionsPerRoute(httpClient.getMaxConnectionsPerRoute()); + config.setHttpClientConfigDto(clientConfigDto); + } + private void populateInternalTokenIssuer(APIKeyEnforcer runtimeToken) { APIKeyIssuerDto apiKeyIssuerDto = new APIKeyIssuerDto(); diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/EnforcerConfig.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/EnforcerConfig.java index 6e34a27a3..0eafcd05e 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/EnforcerConfig.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/EnforcerConfig.java @@ -25,6 +25,7 @@ import org.wso2.apk.enforcer.config.dto.AnalyticsDTO; import org.wso2.apk.enforcer.config.dto.AuthServiceConfigurationDto; import org.wso2.apk.enforcer.config.dto.CacheDto; +import org.wso2.apk.enforcer.config.dto.ClientConfigDto; import org.wso2.apk.enforcer.config.dto.FilterDTO; import org.wso2.apk.enforcer.config.dto.ManagementCredentialsDto; import org.wso2.apk.enforcer.config.dto.MetricsDTO; @@ -60,6 +61,17 @@ public class EnforcerConfig { private SoapErrorResponseConfigDto soapErrorResponseConfigDto; private boolean mandateSubscriptionValidation; + private ClientConfigDto httpClientConfigDto; + + public ClientConfigDto getHttpClientConfigDto() { + + return httpClientConfigDto; + } + + public void setHttpClientConfigDto(ClientConfigDto httpClientConfigDto) { + + this.httpClientConfigDto = httpClientConfigDto; + } public AuthServiceConfigurationDto getAuthService() { return authService; diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/dto/ClientConfigDto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/dto/ClientConfigDto.java new file mode 100644 index 000000000..b8cca630a --- /dev/null +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/config/dto/ClientConfigDto.java @@ -0,0 +1,91 @@ +/* + * 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. + */ +package org.wso2.apk.enforcer.config.dto; + +/** + * This contains HttpClient properties. + */ +public class ClientConfigDto { + + private boolean enableSslVerification; + private String hostnameVerifier; + private int connectionTimeout; + private int socketTimeout; + private int maxConnections; + private int maxConnectionsPerRoute; + + public boolean isEnableSslVerification() { + + return enableSslVerification; + } + + public void setEnableSslVerification(boolean enableSslVerification) { + + this.enableSslVerification = enableSslVerification; + } + + public String getHostnameVerifier() { + + return hostnameVerifier; + } + + public void setHostnameVerifier(String hostnameVerifier) { + + this.hostnameVerifier = hostnameVerifier; + } + + public int getConnectionTimeout() { + + return connectionTimeout; + } + + public void setConnectionTimeout(int connectionTimeout) { + + this.connectionTimeout = connectionTimeout; + } + + public int getSocketTimeout() { + + return socketTimeout; + } + + public void setSocketTimeout(int socketTimeout) { + + this.socketTimeout = socketTimeout; + } + + public int getMaxConnections() { + + return maxConnections; + } + + public void setMaxConnections(int maxConnections) { + + this.maxConnections = maxConnections; + } + + public int getMaxConnectionsPerRoute() { + + return maxConnectionsPerRoute; + } + + public void setMaxConnectionsPerRoute(int maxConnectionsPerRoute) { + + this.maxConnectionsPerRoute = maxConnectionsPerRoute; + } +} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/Config.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/Config.java index ef4490fce..60fd86a76 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/Config.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/Config.java @@ -211,6 +211,19 @@ private Config( mandateSubscriptionValidation_ = input.readBool(); break; } + case 114: { + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.Builder subBuilder = null; + if (httpClient_ != null) { + subBuilder = httpClient_.toBuilder(); + } + httpClient_ = input.readMessage(org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(httpClient_); + httpClient_ = subBuilder.buildPartial(); + } + + break; + } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { @@ -583,6 +596,32 @@ public boolean getMandateSubscriptionValidation() { return mandateSubscriptionValidation_; } + public static final int HTTPCLIENT_FIELD_NUMBER = 14; + private org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient httpClient_; + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + * @return Whether the httpClient field is set. + */ + @java.lang.Override + public boolean hasHttpClient() { + return httpClient_ != null; + } + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + * @return The httpClient. + */ + @java.lang.Override + public org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient getHttpClient() { + return httpClient_ == null ? org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.getDefaultInstance() : httpClient_; + } + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + */ + @java.lang.Override + public org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientOrBuilder getHttpClientOrBuilder() { + return getHttpClient(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -636,6 +675,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (mandateSubscriptionValidation_ != false) { output.writeBool(13, mandateSubscriptionValidation_); } + if (httpClient_ != null) { + output.writeMessage(14, getHttpClient()); + } unknownFields.writeTo(output); } @@ -697,6 +739,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeBoolSize(13, mandateSubscriptionValidation_); } + if (httpClient_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(14, getHttpClient()); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -771,6 +817,11 @@ public boolean equals(final java.lang.Object obj) { } if (getMandateSubscriptionValidation() != other.getMandateSubscriptionValidation()) return false; + if (hasHttpClient() != other.hasHttpClient()) return false; + if (hasHttpClient()) { + if (!getHttpClient() + .equals(other.getHttpClient())) return false; + } if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -833,6 +884,10 @@ public int hashCode() { hash = (37 * hash) + MANDATESUBSCRIPTIONVALIDATION_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( getMandateSubscriptionValidation()); + if (hasHttpClient()) { + hash = (37 * hash) + HTTPCLIENT_FIELD_NUMBER; + hash = (53 * hash) + getHttpClient().hashCode(); + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -1045,6 +1100,12 @@ public Builder clear() { } mandateSubscriptionValidation_ = false; + if (httpClientBuilder_ == null) { + httpClient_ = null; + } else { + httpClient_ = null; + httpClientBuilder_ = null; + } return this; } @@ -1137,6 +1198,11 @@ public org.wso2.apk.enforcer.discovery.config.enforcer.Config buildPartial() { result.soap_ = soapBuilder_.build(); } result.mandateSubscriptionValidation_ = mandateSubscriptionValidation_; + if (httpClientBuilder_ == null) { + result.httpClient_ = httpClient_; + } else { + result.httpClient_ = httpClientBuilder_.build(); + } onBuilt(); return result; } @@ -1247,6 +1313,9 @@ public Builder mergeFrom(org.wso2.apk.enforcer.discovery.config.enforcer.Config if (other.getMandateSubscriptionValidation() != false) { setMandateSubscriptionValidation(other.getMandateSubscriptionValidation()); } + if (other.hasHttpClient()) { + mergeHttpClient(other.getHttpClient()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -2856,6 +2925,125 @@ public Builder clearMandateSubscriptionValidation() { onChanged(); return this; } + + private org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient httpClient_; + private com.google.protobuf.SingleFieldBuilderV3< + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient, org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.Builder, org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientOrBuilder> httpClientBuilder_; + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + * @return Whether the httpClient field is set. + */ + public boolean hasHttpClient() { + return httpClientBuilder_ != null || httpClient_ != null; + } + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + * @return The httpClient. + */ + public org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient getHttpClient() { + if (httpClientBuilder_ == null) { + return httpClient_ == null ? org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.getDefaultInstance() : httpClient_; + } else { + return httpClientBuilder_.getMessage(); + } + } + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + */ + public Builder setHttpClient(org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient value) { + if (httpClientBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + httpClient_ = value; + onChanged(); + } else { + httpClientBuilder_.setMessage(value); + } + + return this; + } + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + */ + public Builder setHttpClient( + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.Builder builderForValue) { + if (httpClientBuilder_ == null) { + httpClient_ = builderForValue.build(); + onChanged(); + } else { + httpClientBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + */ + public Builder mergeHttpClient(org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient value) { + if (httpClientBuilder_ == null) { + if (httpClient_ != null) { + httpClient_ = + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.newBuilder(httpClient_).mergeFrom(value).buildPartial(); + } else { + httpClient_ = value; + } + onChanged(); + } else { + httpClientBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + */ + public Builder clearHttpClient() { + if (httpClientBuilder_ == null) { + httpClient_ = null; + onChanged(); + } else { + httpClient_ = null; + httpClientBuilder_ = null; + } + + return this; + } + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + */ + public org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.Builder getHttpClientBuilder() { + + onChanged(); + return getHttpClientFieldBuilder().getBuilder(); + } + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + */ + public org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientOrBuilder getHttpClientOrBuilder() { + if (httpClientBuilder_ != null) { + return httpClientBuilder_.getMessageOrBuilder(); + } else { + return httpClient_ == null ? + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.getDefaultInstance() : httpClient_; + } + } + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + */ + private com.google.protobuf.SingleFieldBuilderV3< + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient, org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.Builder, org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientOrBuilder> + getHttpClientFieldBuilder() { + if (httpClientBuilder_ == null) { + httpClientBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient, org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.Builder, org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientOrBuilder>( + getHttpClient(), + getParentForChildren(), + isClean()); + httpClient_ = null; + } + return httpClientBuilder_; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/ConfigOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/ConfigOrBuilder.java index 943b29c5a..8ee7c234d 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/ConfigOrBuilder.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/ConfigOrBuilder.java @@ -201,4 +201,19 @@ org.wso2.apk.enforcer.discovery.config.enforcer.FilterOrBuilder getFiltersOrBuil * @return The mandateSubscriptionValidation. */ boolean getMandateSubscriptionValidation(); + + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + * @return Whether the httpClient field is set. + */ + boolean hasHttpClient(); + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + * @return The httpClient. + */ + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient getHttpClient(); + /** + * .wso2.discovery.config.enforcer.HttpClient httpClient = 14; + */ + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientOrBuilder getHttpClientOrBuilder(); } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/ConfigProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/ConfigProto.java index 8ddb2cfe1..1850792ed 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/ConfigProto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/ConfigProto.java @@ -42,30 +42,33 @@ public static void registerAllExtensions( "ilter.proto\032,wso2/discovery/config/enfor" + "cer/tracing.proto\032,wso2/discovery/config" + "/enforcer/metrics.proto\032)wso2/discovery/" + - "config/enforcer/soap.proto\"\376\005\n\006Config\022:\n" + - "\010security\030\001 \001(\0132(.wso2.discovery.config." + - "enforcer.Security\022;\n\010keystore\030\002 \001(\0132).ws" + - "o2.discovery.config.enforcer.CertStore\022=" + - "\n\ntruststore\030\003 \001(\0132).wso2.discovery.conf" + - "ig.enforcer.CertStore\022<\n\013authService\030\004 \001" + - "(\0132\'.wso2.discovery.config.enforcer.Serv" + - "ice\022B\n\014jwtGenerator\030\005 \001(\0132,.wso2.discove" + - "ry.config.enforcer.JWTGenerator\0224\n\005cache" + - "\030\006 \001(\0132%.wso2.discovery.config.enforcer." + - "Cache\022<\n\tanalytics\030\007 \001(\0132).wso2.discover" + - "y.config.enforcer.Analytics\022>\n\nmanagemen" + - "t\030\010 \001(\0132*.wso2.discovery.config.enforcer" + - ".Management\0228\n\007tracing\030\t \001(\0132\'.wso2.disc" + - "overy.config.enforcer.Tracing\0228\n\007metrics" + - "\030\n \001(\0132\'.wso2.discovery.config.enforcer." + - "Metrics\0227\n\007filters\030\013 \003(\0132&.wso2.discover" + - "y.config.enforcer.Filter\0222\n\004soap\030\014 \001(\0132$" + - ".wso2.discovery.config.enforcer.Soap\022%\n\035" + - "mandateSubscriptionValidation\030\r \001(\010B\220\001\n/" + - "org.wso2.apk.enforcer.discovery.config.e" + - "nforcerB\013ConfigProtoP\001ZNgithub.com/envoy" + - "proxy/go-control-plane/wso2/discovery/co" + - "nfig/enforcer;enforcerb\006proto3" + "config/enforcer/soap.proto\032+wso2/discove" + + "ry/config/enforcer/client.proto\"\276\006\n\006Conf" + + "ig\022:\n\010security\030\001 \001(\0132(.wso2.discovery.co" + + "nfig.enforcer.Security\022;\n\010keystore\030\002 \001(\013" + + "2).wso2.discovery.config.enforcer.CertSt" + + "ore\022=\n\ntruststore\030\003 \001(\0132).wso2.discovery" + + ".config.enforcer.CertStore\022<\n\013authServic" + + "e\030\004 \001(\0132\'.wso2.discovery.config.enforcer" + + ".Service\022B\n\014jwtGenerator\030\005 \001(\0132,.wso2.di" + + "scovery.config.enforcer.JWTGenerator\0224\n\005" + + "cache\030\006 \001(\0132%.wso2.discovery.config.enfo" + + "rcer.Cache\022<\n\tanalytics\030\007 \001(\0132).wso2.dis" + + "covery.config.enforcer.Analytics\022>\n\nmana" + + "gement\030\010 \001(\0132*.wso2.discovery.config.enf" + + "orcer.Management\0228\n\007tracing\030\t \001(\0132\'.wso2" + + ".discovery.config.enforcer.Tracing\0228\n\007me" + + "trics\030\n \001(\0132\'.wso2.discovery.config.enfo" + + "rcer.Metrics\0227\n\007filters\030\013 \003(\0132&.wso2.dis" + + "covery.config.enforcer.Filter\0222\n\004soap\030\014 " + + "\001(\0132$.wso2.discovery.config.enforcer.Soa" + + "p\022%\n\035mandateSubscriptionValidation\030\r \001(\010" + + "\022>\n\nhttpClient\030\016 \001(\0132*.wso2.discovery.co" + + "nfig.enforcer.HttpClientB\220\001\n/org.wso2.ap" + + "k.enforcer.discovery.config.enforcerB\013Co" + + "nfigProtoP\001ZNgithub.com/envoyproxy/go-co" + + "ntrol-plane/wso2/discovery/config/enforc" + + "er;enforcerb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -81,13 +84,14 @@ public static void registerAllExtensions( org.wso2.apk.enforcer.discovery.config.enforcer.TracingProto.getDescriptor(), org.wso2.apk.enforcer.discovery.config.enforcer.MetricsProto.getDescriptor(), org.wso2.apk.enforcer.discovery.config.enforcer.soapProto.getDescriptor(), + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientProto.getDescriptor(), }); internal_static_wso2_discovery_config_enforcer_Config_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_wso2_discovery_config_enforcer_Config_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_wso2_discovery_config_enforcer_Config_descriptor, - new java.lang.String[] { "Security", "Keystore", "Truststore", "AuthService", "JwtGenerator", "Cache", "Analytics", "Management", "Tracing", "Metrics", "Filters", "Soap", "MandateSubscriptionValidation", }); + new java.lang.String[] { "Security", "Keystore", "Truststore", "AuthService", "JwtGenerator", "Cache", "Analytics", "Management", "Tracing", "Metrics", "Filters", "Soap", "MandateSubscriptionValidation", "HttpClient", }); org.wso2.apk.enforcer.discovery.config.enforcer.CertStoreProto.getDescriptor(); org.wso2.apk.enforcer.discovery.config.enforcer.ServiceProto.getDescriptor(); org.wso2.apk.enforcer.discovery.config.enforcer.JWTGeneratorProto.getDescriptor(); @@ -99,6 +103,7 @@ public static void registerAllExtensions( org.wso2.apk.enforcer.discovery.config.enforcer.TracingProto.getDescriptor(); org.wso2.apk.enforcer.discovery.config.enforcer.MetricsProto.getDescriptor(); org.wso2.apk.enforcer.discovery.config.enforcer.soapProto.getDescriptor(); + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClient.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClient.java new file mode 100644 index 000000000..c21f18bc0 --- /dev/null +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClient.java @@ -0,0 +1,994 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: wso2/discovery/config/enforcer/client.proto + +package org.wso2.apk.enforcer.discovery.config.enforcer; + +/** + *
+ * Model for enforcer management user
+ * 
+ * + * Protobuf type {@code wso2.discovery.config.enforcer.HttpClient} + */ +public final class HttpClient extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:wso2.discovery.config.enforcer.HttpClient) + HttpClientOrBuilder { +private static final long serialVersionUID = 0L; + // Use HttpClient.newBuilder() to construct. + private HttpClient(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private HttpClient() { + hostnameVerifier_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new HttpClient(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private HttpClient( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + skipSSl_ = input.readBool(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + hostnameVerifier_ = s; + break; + } + case 24: { + + maxTotalConnections_ = input.readInt32(); + break; + } + case 32: { + + maxConnectionsPerRoute_ = input.readInt32(); + break; + } + case 40: { + + connectTimeout_ = input.readInt32(); + break; + } + case 48: { + + socketTimeout_ = input.readInt32(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientProto.internal_static_wso2_discovery_config_enforcer_HttpClient_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientProto.internal_static_wso2_discovery_config_enforcer_HttpClient_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.class, org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.Builder.class); + } + + public static final int SKIPSSL_FIELD_NUMBER = 1; + private boolean skipSSl_; + /** + *
+   * Disable SSL Verification
+   * 
+ * + * bool skipSSl = 1; + * @return The skipSSl. + */ + @java.lang.Override + public boolean getSkipSSl() { + return skipSSl_; + } + + public static final int HOSTNAMEVERIFIER_FIELD_NUMBER = 2; + private volatile java.lang.Object hostnameVerifier_; + /** + *
+   * Hostname Verifier
+   * 
+ * + * string hostnameVerifier = 2; + * @return The hostnameVerifier. + */ + @java.lang.Override + public java.lang.String getHostnameVerifier() { + java.lang.Object ref = hostnameVerifier_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + hostnameVerifier_ = s; + return s; + } + } + /** + *
+   * Hostname Verifier
+   * 
+ * + * string hostnameVerifier = 2; + * @return The bytes for hostnameVerifier. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getHostnameVerifierBytes() { + java.lang.Object ref = hostnameVerifier_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + hostnameVerifier_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MAXTOTALCONNECTIONS_FIELD_NUMBER = 3; + private int maxTotalConnections_; + /** + *
+   * MaxtotalConnections
+   * 
+ * + * int32 maxTotalConnections = 3; + * @return The maxTotalConnections. + */ + @java.lang.Override + public int getMaxTotalConnections() { + return maxTotalConnections_; + } + + public static final int MAXCONNECTIONSPERROUTE_FIELD_NUMBER = 4; + private int maxConnectionsPerRoute_; + /** + *
+   * MaxConnectionsPerRoute
+   * 
+ * + * int32 maxConnectionsPerRoute = 4; + * @return The maxConnectionsPerRoute. + */ + @java.lang.Override + public int getMaxConnectionsPerRoute() { + return maxConnectionsPerRoute_; + } + + public static final int CONNECTTIMEOUT_FIELD_NUMBER = 5; + private int connectTimeout_; + /** + *
+   * ConnectTimeout
+   * 
+ * + * int32 connectTimeout = 5; + * @return The connectTimeout. + */ + @java.lang.Override + public int getConnectTimeout() { + return connectTimeout_; + } + + public static final int SOCKETTIMEOUT_FIELD_NUMBER = 6; + private int socketTimeout_; + /** + *
+   * SocketTimeout
+   * 
+ * + * int32 socketTimeout = 6; + * @return The socketTimeout. + */ + @java.lang.Override + public int getSocketTimeout() { + return socketTimeout_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (skipSSl_ != false) { + output.writeBool(1, skipSSl_); + } + if (!getHostnameVerifierBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, hostnameVerifier_); + } + if (maxTotalConnections_ != 0) { + output.writeInt32(3, maxTotalConnections_); + } + if (maxConnectionsPerRoute_ != 0) { + output.writeInt32(4, maxConnectionsPerRoute_); + } + if (connectTimeout_ != 0) { + output.writeInt32(5, connectTimeout_); + } + if (socketTimeout_ != 0) { + output.writeInt32(6, socketTimeout_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (skipSSl_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, skipSSl_); + } + if (!getHostnameVerifierBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, hostnameVerifier_); + } + if (maxTotalConnections_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, maxTotalConnections_); + } + if (maxConnectionsPerRoute_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, maxConnectionsPerRoute_); + } + if (connectTimeout_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, connectTimeout_); + } + if (socketTimeout_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, socketTimeout_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient)) { + return super.equals(obj); + } + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient other = (org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient) obj; + + if (getSkipSSl() + != other.getSkipSSl()) return false; + if (!getHostnameVerifier() + .equals(other.getHostnameVerifier())) return false; + if (getMaxTotalConnections() + != other.getMaxTotalConnections()) return false; + if (getMaxConnectionsPerRoute() + != other.getMaxConnectionsPerRoute()) return false; + if (getConnectTimeout() + != other.getConnectTimeout()) return false; + if (getSocketTimeout() + != other.getSocketTimeout()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SKIPSSL_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getSkipSSl()); + hash = (37 * hash) + HOSTNAMEVERIFIER_FIELD_NUMBER; + hash = (53 * hash) + getHostnameVerifier().hashCode(); + hash = (37 * hash) + MAXTOTALCONNECTIONS_FIELD_NUMBER; + hash = (53 * hash) + getMaxTotalConnections(); + hash = (37 * hash) + MAXCONNECTIONSPERROUTE_FIELD_NUMBER; + hash = (53 * hash) + getMaxConnectionsPerRoute(); + hash = (37 * hash) + CONNECTTIMEOUT_FIELD_NUMBER; + hash = (53 * hash) + getConnectTimeout(); + hash = (37 * hash) + SOCKETTIMEOUT_FIELD_NUMBER; + hash = (53 * hash) + getSocketTimeout(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Model for enforcer management user
+   * 
+ * + * Protobuf type {@code wso2.discovery.config.enforcer.HttpClient} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:wso2.discovery.config.enforcer.HttpClient) + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientProto.internal_static_wso2_discovery_config_enforcer_HttpClient_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientProto.internal_static_wso2_discovery_config_enforcer_HttpClient_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.class, org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.Builder.class); + } + + // Construct using org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + skipSSl_ = false; + + hostnameVerifier_ = ""; + + maxTotalConnections_ = 0; + + maxConnectionsPerRoute_ = 0; + + connectTimeout_ = 0; + + socketTimeout_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.wso2.apk.enforcer.discovery.config.enforcer.HttpClientProto.internal_static_wso2_discovery_config_enforcer_HttpClient_descriptor; + } + + @java.lang.Override + public org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient getDefaultInstanceForType() { + return org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.getDefaultInstance(); + } + + @java.lang.Override + public org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient build() { + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient buildPartial() { + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient result = new org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient(this); + result.skipSSl_ = skipSSl_; + result.hostnameVerifier_ = hostnameVerifier_; + result.maxTotalConnections_ = maxTotalConnections_; + result.maxConnectionsPerRoute_ = maxConnectionsPerRoute_; + result.connectTimeout_ = connectTimeout_; + result.socketTimeout_ = socketTimeout_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient) { + return mergeFrom((org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient other) { + if (other == org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient.getDefaultInstance()) return this; + if (other.getSkipSSl() != false) { + setSkipSSl(other.getSkipSSl()); + } + if (!other.getHostnameVerifier().isEmpty()) { + hostnameVerifier_ = other.hostnameVerifier_; + onChanged(); + } + if (other.getMaxTotalConnections() != 0) { + setMaxTotalConnections(other.getMaxTotalConnections()); + } + if (other.getMaxConnectionsPerRoute() != 0) { + setMaxConnectionsPerRoute(other.getMaxConnectionsPerRoute()); + } + if (other.getConnectTimeout() != 0) { + setConnectTimeout(other.getConnectTimeout()); + } + if (other.getSocketTimeout() != 0) { + setSocketTimeout(other.getSocketTimeout()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean skipSSl_ ; + /** + *
+     * Disable SSL Verification
+     * 
+ * + * bool skipSSl = 1; + * @return The skipSSl. + */ + @java.lang.Override + public boolean getSkipSSl() { + return skipSSl_; + } + /** + *
+     * Disable SSL Verification
+     * 
+ * + * bool skipSSl = 1; + * @param value The skipSSl to set. + * @return This builder for chaining. + */ + public Builder setSkipSSl(boolean value) { + + skipSSl_ = value; + onChanged(); + return this; + } + /** + *
+     * Disable SSL Verification
+     * 
+ * + * bool skipSSl = 1; + * @return This builder for chaining. + */ + public Builder clearSkipSSl() { + + skipSSl_ = false; + onChanged(); + return this; + } + + private java.lang.Object hostnameVerifier_ = ""; + /** + *
+     * Hostname Verifier
+     * 
+ * + * string hostnameVerifier = 2; + * @return The hostnameVerifier. + */ + public java.lang.String getHostnameVerifier() { + java.lang.Object ref = hostnameVerifier_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + hostnameVerifier_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Hostname Verifier
+     * 
+ * + * string hostnameVerifier = 2; + * @return The bytes for hostnameVerifier. + */ + public com.google.protobuf.ByteString + getHostnameVerifierBytes() { + java.lang.Object ref = hostnameVerifier_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + hostnameVerifier_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Hostname Verifier
+     * 
+ * + * string hostnameVerifier = 2; + * @param value The hostnameVerifier to set. + * @return This builder for chaining. + */ + public Builder setHostnameVerifier( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + hostnameVerifier_ = value; + onChanged(); + return this; + } + /** + *
+     * Hostname Verifier
+     * 
+ * + * string hostnameVerifier = 2; + * @return This builder for chaining. + */ + public Builder clearHostnameVerifier() { + + hostnameVerifier_ = getDefaultInstance().getHostnameVerifier(); + onChanged(); + return this; + } + /** + *
+     * Hostname Verifier
+     * 
+ * + * string hostnameVerifier = 2; + * @param value The bytes for hostnameVerifier to set. + * @return This builder for chaining. + */ + public Builder setHostnameVerifierBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + hostnameVerifier_ = value; + onChanged(); + return this; + } + + private int maxTotalConnections_ ; + /** + *
+     * MaxtotalConnections
+     * 
+ * + * int32 maxTotalConnections = 3; + * @return The maxTotalConnections. + */ + @java.lang.Override + public int getMaxTotalConnections() { + return maxTotalConnections_; + } + /** + *
+     * MaxtotalConnections
+     * 
+ * + * int32 maxTotalConnections = 3; + * @param value The maxTotalConnections to set. + * @return This builder for chaining. + */ + public Builder setMaxTotalConnections(int value) { + + maxTotalConnections_ = value; + onChanged(); + return this; + } + /** + *
+     * MaxtotalConnections
+     * 
+ * + * int32 maxTotalConnections = 3; + * @return This builder for chaining. + */ + public Builder clearMaxTotalConnections() { + + maxTotalConnections_ = 0; + onChanged(); + return this; + } + + private int maxConnectionsPerRoute_ ; + /** + *
+     * MaxConnectionsPerRoute
+     * 
+ * + * int32 maxConnectionsPerRoute = 4; + * @return The maxConnectionsPerRoute. + */ + @java.lang.Override + public int getMaxConnectionsPerRoute() { + return maxConnectionsPerRoute_; + } + /** + *
+     * MaxConnectionsPerRoute
+     * 
+ * + * int32 maxConnectionsPerRoute = 4; + * @param value The maxConnectionsPerRoute to set. + * @return This builder for chaining. + */ + public Builder setMaxConnectionsPerRoute(int value) { + + maxConnectionsPerRoute_ = value; + onChanged(); + return this; + } + /** + *
+     * MaxConnectionsPerRoute
+     * 
+ * + * int32 maxConnectionsPerRoute = 4; + * @return This builder for chaining. + */ + public Builder clearMaxConnectionsPerRoute() { + + maxConnectionsPerRoute_ = 0; + onChanged(); + return this; + } + + private int connectTimeout_ ; + /** + *
+     * ConnectTimeout
+     * 
+ * + * int32 connectTimeout = 5; + * @return The connectTimeout. + */ + @java.lang.Override + public int getConnectTimeout() { + return connectTimeout_; + } + /** + *
+     * ConnectTimeout
+     * 
+ * + * int32 connectTimeout = 5; + * @param value The connectTimeout to set. + * @return This builder for chaining. + */ + public Builder setConnectTimeout(int value) { + + connectTimeout_ = value; + onChanged(); + return this; + } + /** + *
+     * ConnectTimeout
+     * 
+ * + * int32 connectTimeout = 5; + * @return This builder for chaining. + */ + public Builder clearConnectTimeout() { + + connectTimeout_ = 0; + onChanged(); + return this; + } + + private int socketTimeout_ ; + /** + *
+     * SocketTimeout
+     * 
+ * + * int32 socketTimeout = 6; + * @return The socketTimeout. + */ + @java.lang.Override + public int getSocketTimeout() { + return socketTimeout_; + } + /** + *
+     * SocketTimeout
+     * 
+ * + * int32 socketTimeout = 6; + * @param value The socketTimeout to set. + * @return This builder for chaining. + */ + public Builder setSocketTimeout(int value) { + + socketTimeout_ = value; + onChanged(); + return this; + } + /** + *
+     * SocketTimeout
+     * 
+ * + * int32 socketTimeout = 6; + * @return This builder for chaining. + */ + public Builder clearSocketTimeout() { + + socketTimeout_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:wso2.discovery.config.enforcer.HttpClient) + } + + // @@protoc_insertion_point(class_scope:wso2.discovery.config.enforcer.HttpClient) + private static final org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient(); + } + + public static org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public HttpClient parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new HttpClient(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.wso2.apk.enforcer.discovery.config.enforcer.HttpClient getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClientOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClientOrBuilder.java new file mode 100644 index 000000000..4ae0fd19f --- /dev/null +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClientOrBuilder.java @@ -0,0 +1,79 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: wso2/discovery/config/enforcer/client.proto + +package org.wso2.apk.enforcer.discovery.config.enforcer; + +public interface HttpClientOrBuilder extends + // @@protoc_insertion_point(interface_extends:wso2.discovery.config.enforcer.HttpClient) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Disable SSL Verification
+   * 
+ * + * bool skipSSl = 1; + * @return The skipSSl. + */ + boolean getSkipSSl(); + + /** + *
+   * Hostname Verifier
+   * 
+ * + * string hostnameVerifier = 2; + * @return The hostnameVerifier. + */ + java.lang.String getHostnameVerifier(); + /** + *
+   * Hostname Verifier
+   * 
+ * + * string hostnameVerifier = 2; + * @return The bytes for hostnameVerifier. + */ + com.google.protobuf.ByteString + getHostnameVerifierBytes(); + + /** + *
+   * MaxtotalConnections
+   * 
+ * + * int32 maxTotalConnections = 3; + * @return The maxTotalConnections. + */ + int getMaxTotalConnections(); + + /** + *
+   * MaxConnectionsPerRoute
+   * 
+ * + * int32 maxConnectionsPerRoute = 4; + * @return The maxConnectionsPerRoute. + */ + int getMaxConnectionsPerRoute(); + + /** + *
+   * ConnectTimeout
+   * 
+ * + * int32 connectTimeout = 5; + * @return The connectTimeout. + */ + int getConnectTimeout(); + + /** + *
+   * SocketTimeout
+   * 
+ * + * int32 socketTimeout = 6; + * @return The socketTimeout. + */ + int getSocketTimeout(); +} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClientProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClientProto.java new file mode 100644 index 000000000..e1943cd97 --- /dev/null +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/config/enforcer/HttpClientProto.java @@ -0,0 +1,56 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: wso2/discovery/config/enforcer/client.proto + +package org.wso2.apk.enforcer.discovery.config.enforcer; + +public final class HttpClientProto { + private HttpClientProto() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + static final com.google.protobuf.Descriptors.Descriptor + internal_static_wso2_discovery_config_enforcer_HttpClient_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_wso2_discovery_config_enforcer_HttpClient_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n+wso2/discovery/config/enforcer/client." + + "proto\022\036wso2.discovery.config.enforcer\"\243\001" + + "\n\nHttpClient\022\017\n\007skipSSl\030\001 \001(\010\022\030\n\020hostnam" + + "eVerifier\030\002 \001(\t\022\033\n\023maxTotalConnections\030\003" + + " \001(\005\022\036\n\026maxConnectionsPerRoute\030\004 \001(\005\022\026\n\016" + + "connectTimeout\030\005 \001(\005\022\025\n\rsocketTimeout\030\006 " + + "\001(\005B\224\001\n/org.wso2.apk.enforcer.discovery." + + "config.enforcerB\017HttpClientProtoP\001ZNgith" + + "ub.com/envoyproxy/go-control-plane/wso2/" + + "discovery/config/enforcer;enforcerb\006prot" + + "o3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_wso2_discovery_config_enforcer_HttpClient_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_wso2_discovery_config_enforcer_HttpClient_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_wso2_discovery_config_enforcer_HttpClient_descriptor, + new java.lang.String[] { "SkipSSl", "HostnameVerifier", "MaxTotalConnections", "MaxConnectionsPerRoute", "ConnectTimeout", "SocketTimeout", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/apkmgt/EventServiceProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/apkmgt/EventServiceProto.java index 8125f757a..2ebf3bdcc 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/apkmgt/EventServiceProto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/service/apkmgt/EventServiceProto.java @@ -34,11 +34,11 @@ public static void registerAllExtensions( "est\022\r\n\005event\030\001 \001(\t2o\n\022EventStreamService" + "\022Y\n\014StreamEvents\022!.discovery.service.apk" + "mgt.Request\032\".wso2.discovery.subscriptio" + - "n.Event\"\0000\001B\234\001\n.org.wso2.apk.enforcer.di" + + "n.Event\"\0000\001B\225\001\n.org.wso2.apk.enforcer.di" + "scovery.service.apkmgtB\021EventServiceProt" + - "oP\001ZRgithub.com/wso2/apk/common-go-libs/" + - "pkg/discovery/api/wso2/discovery/service" + - "/apkmgt\210\001\001b\006proto3" + "oP\001ZKgithub.com/wso2/apk/adapter/pkg/dis" + + "covery/api/wso2/discovery/service/apkmgt" + + "\210\001\001b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingProto.java index 3091c2736..db027867b 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingProto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationKeyMappingProto.java @@ -34,11 +34,11 @@ public static void registerAllExtensions( "plicationUUID\030\001 \001(\t\022\026\n\016securityScheme\030\002 " + "\001(\t\022\035\n\025applicationIdentifier\030\003 \001(\t\022\017\n\007ke" + "yType\030\004 \001(\t\022\r\n\005envID\030\005 \001(\t\022\021\n\ttimestamp\030" + - "\006 \001(\003\022\024\n\014organization\030\007 \001(\tB\236\001\n,org.wso2" + + "\006 \001(\003\022\024\n\014organization\030\007 \001(\tB\227\001\n,org.wso2" + ".apk.enforcer.discovery.subscriptionB\032Ap" + - "plicationKeyMappingProtoP\001ZPgithub.com/w" + - "so2/apk/common-go-libs/pkg/discovery/api" + - "/wso2/discovery/subscriptionb\006proto3" + "plicationKeyMappingProtoP\001ZIgithub.com/w" + + "so2/apk/adapter/pkg/discovery/api/wso2/d" + + "iscovery/subscriptionb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingProto.java index 616284188..db924973b 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingProto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationMappingProto.java @@ -32,11 +32,11 @@ public static void registerAllExtensions( "nmapping.proto\022\033wso2.discovery.subscript" + "ion\"i\n\022ApplicationMapping\022\014\n\004uuid\030\001 \001(\t\022" + "\026\n\016applicationRef\030\002 \001(\t\022\027\n\017subscriptionR" + - "ef\030\003 \001(\t\022\024\n\014organization\030\004 \001(\tB\233\001\n,org.w" + + "ef\030\003 \001(\t\022\024\n\014organization\030\004 \001(\tB\224\001\n,org.w" + "so2.apk.enforcer.discovery.subscriptionB" + - "\027ApplicationMappingProtoP\001ZPgithub.com/w" + - "so2/apk/common-go-libs/pkg/discovery/api" + - "/wso2/discovery/subscriptionb\006proto3" + "\027ApplicationMappingProtoP\001ZIgithub.com/w" + + "so2/apk/adapter/pkg/discovery/api/wso2/d" + + "iscovery/subscriptionb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationProto.java index bfcf136f5..49d0be32a 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationProto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/ApplicationProto.java @@ -40,11 +40,10 @@ public static void registerAllExtensions( "\nattributes\030\005 \003(\01328.wso2.discovery.subsc" + "ription.Application.AttributesEntry\0321\n\017A" + "ttributesEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001" + - "(\t:\0028\001B\224\001\n,org.wso2.apk.enforcer.discove" + - "ry.subscriptionB\020ApplicationProtoP\001ZPgit" + - "hub.com/wso2/apk/common-go-libs/pkg/disc" + - "overy/api/wso2/discovery/subscriptionb\006p" + - "roto3" + "(\t:\0028\001B\215\001\n,org.wso2.apk.enforcer.discove" + + "ry.subscriptionB\020ApplicationProtoP\001ZIgit" + + "hub.com/wso2/apk/adapter/pkg/discovery/a" + + "pi/wso2/discovery/subscriptionb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/EventProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/EventProto.java index ddf36b01e..7c794cb2e 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/EventProto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/EventProto.java @@ -43,11 +43,11 @@ public static void registerAllExtensions( "pplicationKeyMapping\030\006 \001(\01322.wso2.discov" + "ery.subscription.ApplicationKeyMapping\022?" + "\n\014subscription\030\007 \001(\0132).wso2.discovery.su" + - "bscription.SubscriptionB\216\001\n,org.wso2.apk" + + "bscription.SubscriptionB\207\001\n,org.wso2.apk" + ".enforcer.discovery.subscriptionB\nEventP" + - "rotoP\001ZPgithub.com/wso2/apk/common-go-li" + - "bs/pkg/discovery/api/wso2/discovery/subs" + - "criptionb\006proto3" + "rotoP\001ZIgithub.com/wso2/apk/adapter/pkg/" + + "discovery/api/wso2/discovery/subscriptio" + + "nb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/SubscriptionProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/SubscriptionProto.java index 14e8baa70..d8fe93be3 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/SubscriptionProto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/SubscriptionProto.java @@ -39,11 +39,11 @@ public static void registerAllExtensions( "d\030\002 \001(\t\022\024\n\014organization\030\003 \001(\t\022A\n\rsubscri" + "bedApi\030\004 \001(\0132*.wso2.discovery.subscripti" + "on.SubscribedAPI\".\n\rSubscribedAPI\022\014\n\004nam" + - "e\030\001 \001(\t\022\017\n\007version\030\002 \001(\tB\225\001\n,org.wso2.ap" + + "e\030\001 \001(\t\022\017\n\007version\030\002 \001(\tB\216\001\n,org.wso2.ap" + "k.enforcer.discovery.subscriptionB\021Subsc" + - "riptionProtoP\001ZPgithub.com/wso2/apk/comm" + - "on-go-libs/pkg/discovery/api/wso2/discov" + - "ery/subscriptionb\006proto3" + "riptionProtoP\001ZIgithub.com/wso2/apk/adap" + + "ter/pkg/discovery/api/wso2/discovery/sub" + + "scriptionb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/FilterUtils.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/FilterUtils.java index 1c768c3f1..31b54907e 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/FilterUtils.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/FilterUtils.java @@ -28,11 +28,11 @@ import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.conn.ssl.SSLContextBuilder; -import org.apache.http.conn.ssl.SSLContexts; import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.conn.ssl.TrustAllStrategy; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.ssl.SSLContextBuilder; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.wso2.apk.enforcer.commons.constants.JWTConstants; @@ -45,6 +45,7 @@ import org.wso2.apk.enforcer.commons.model.AuthenticationContext; import org.wso2.apk.enforcer.commons.model.RequestContext; import org.wso2.apk.enforcer.config.ConfigHolder; +import org.wso2.apk.enforcer.config.dto.ClientConfigDto; import org.wso2.apk.enforcer.config.dto.MutualSSLDto; import org.wso2.apk.enforcer.constants.APIConstants; import org.wso2.apk.enforcer.constants.APISecurityConstants; @@ -66,7 +67,6 @@ import java.security.cert.CertificateException; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -74,7 +74,6 @@ import javax.net.ssl.HostnameVerifier; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; /** * Common set of utility methods used by the filter core component. @@ -82,7 +81,7 @@ public class FilterUtils { private static final Logger log = LogManager.getLogger(FilterUtils.class); - public static final String HOST_NAME_VERIFIER = "httpclient.hostnameVerifier"; + public static final String STRICT = "Strict"; public static final String ALLOW_ALL = "AllowAll"; public static final List SKIPPED_FAULT_CODES = new ArrayList<>(); @@ -127,9 +126,15 @@ public static HttpClient getHttpClient(KeyStore clientKeyStore, KeyStore clientT int maxTotal = 100; //TODO : Read from config int defaultMaxPerRoute = 10; //TODO : Read from config - + ClientConfigDto httpClientConfigDto = ConfigHolder.getInstance().getConfig().getHttpClientConfigDto(); if (options == null) { - options = Collections.emptyMap(); + options = new HashMap<>(); + options.put(HTTPClientOptions.CONNECT_TIMEOUT, httpClientConfigDto.getConnectionTimeout()); + options.put(HTTPClientOptions.SOCKET_TIMEOUT, httpClientConfigDto.getSocketTimeout()); + options.put(HTTPClientOptions.MAX_OPEN_CONNECTIONS, httpClientConfigDto.getMaxConnections()); + options.put(HTTPClientOptions.MAX_PER_ROUTE, httpClientConfigDto.getMaxConnectionsPerRoute()); + options.put(HTTPClientOptions.ENABLE_SSL_VERIFICATION, httpClientConfigDto.isEnableSslVerification()); + options.put(HTTPClientOptions.HOSTNAME_VERIFIER, httpClientConfigDto.getHostnameVerifier()); } PoolingHttpClientConnectionManager pool = null; @@ -141,7 +146,6 @@ public static HttpClient getHttpClient(KeyStore clientKeyStore, KeyStore clientT } catch (EnforcerException e) { log.error("Error while getting http client connection manager", e); } - RequestConfig.Builder pramsBuilder = RequestConfig.custom(); if (options.containsKey(HTTPClientOptions.CONNECT_TIMEOUT)) { pramsBuilder.setConnectTimeout((Integer) options.get(HTTPClientOptions.CONNECT_TIMEOUT)); @@ -193,31 +197,33 @@ private static SSLConnectionSocketFactory createSocketFactory(KeyStore clientKey Map options) throws EnforcerException { SSLContext sslContext; + String hostnameVerifierOption = (String) options.getOrDefault(HTTPClientOptions.HOSTNAME_VERIFIER, null); + boolean enableSSLValidation = (boolean) options.getOrDefault(HTTPClientOptions.ENABLE_SSL_VERIFICATION, true); try { KeyStore trustStore = ConfigHolder.getInstance().getTrustStore(); if (clientTrustStore != null) { trustStore = clientTrustStore; } - SSLContextBuilder sslContextBuilder = SSLContexts.custom().loadTrustMaterial(trustStore); + SSLContextBuilder sslContextBuilder; + if (enableSSLValidation) { + sslContextBuilder = SSLContextBuilder.create().loadTrustMaterial(trustStore, null); + } else { + sslContextBuilder = SSLContextBuilder.create().loadTrustMaterial(trustStore, new TrustAllStrategy()); + } if (clientKeyStore != null) { sslContextBuilder.loadKeyMaterial(clientKeyStore, null); } sslContext = sslContextBuilder.build(); HostnameVerifier hostnameVerifier; - String hostnameVerifierOption = System.getProperty(HOST_NAME_VERIFIER); Object hostnames = options.get("HOSTNAMES"); if (hostnames instanceof List) { - hostnameVerifier = new HostnameVerifier() { - - @Override - public boolean verify(String hostname, SSLSession session) { + hostnameVerifier = (hostname, session) -> { - if (hostnames != null && ((List) hostnames).contains(hostname)) { - return true; - } - return false; + if (hostnames != null && ((List) hostnames).contains(hostname)) { + return true; } + return false; }; } if (ALLOW_ALL.equalsIgnoreCase(hostnameVerifierOption)) { @@ -626,5 +632,8 @@ public static class HTTPClientOptions { public static final String SOCKET_TIMEOUT = "SOCKET_TIMEOUT"; public static final String MAX_OPEN_CONNECTIONS = "MAX_OPEN_CONNECTIONS"; public static final String MAX_PER_ROUTE = "MAX_PER_ROUTE"; + public static final String ENABLE_SSL_VERIFICATION = "ENABLE_SSL_VERIFICATION"; + + public static final String HOSTNAME_VERIFIER = "HOSTNAME_VERIFIER"; } } From 491ffeee583e8d500a6d7717b2c995d0052d23e6 Mon Sep 17 00:00:00 2001 From: tharindu1st Date: Sun, 11 Feb 2024 22:58:35 +0530 Subject: [PATCH 2/2] fix subs validation issue --- .../wso2/discovery/config/enforcer/client.proto | 16 ++++++++++++++++ .../cp/applicationmapping_controller.go | 3 ++- .../internal/server/event_server.go | 2 +- common-controller/internal/server/server.go | 5 +++++ common-controller/internal/utils/event_utils.go | 5 +++-- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/adapter/api/proto/wso2/discovery/config/enforcer/client.proto b/adapter/api/proto/wso2/discovery/config/enforcer/client.proto index a7023f4cb..32d434fde 100644 --- a/adapter/api/proto/wso2/discovery/config/enforcer/client.proto +++ b/adapter/api/proto/wso2/discovery/config/enforcer/client.proto @@ -1,3 +1,19 @@ +// 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"; package wso2.discovery.config.enforcer; diff --git a/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go b/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go index 9599f0b11..b4cda9e4f 100644 --- a/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go +++ b/common-controller/internal/operator/controllers/cp/applicationmapping_controller.go @@ -121,7 +121,8 @@ func (r *ApplicationMappingReconciler) Reconcile(ctx context.Context, req ctrl.R applicationMapping, found := r.ods.GetApplicationMappingFromStore(applicationMappingKey) if found { loggers.LoggerAPKOperator.Debugf("Application mapping %s/%s found in operator data store. Deleting from operator data store and sending delete event to server", applicationMappingKey.Namespace, applicationMappingKey.Name) - utils.SendDeleteApplicationMappingEvent(applicationMappingKey.Name, applicationMapping) + resolvedApplicationMapping := server.GetApplicationMappingFromStore(applicationMappingKey.Name) + utils.SendDeleteApplicationMappingEvent(applicationMappingKey.Name, applicationMapping, resolvedApplicationMapping.OrganizationID) r.ods.DeleteApplicationMappingFromStore(applicationMappingKey) server.DeleteApplicationMapping(applicationMappingKey.Name) } else { diff --git a/common-controller/internal/server/event_server.go b/common-controller/internal/server/event_server.go index de6773957..bb0f10c13 100644 --- a/common-controller/internal/server/event_server.go +++ b/common-controller/internal/server/event_server.go @@ -2,7 +2,7 @@ package server import ( "github.com/wso2/apk/common-controller/internal/loggers" - utils "github.com/wso2/apk/common-controller/internal/utils" + "github.com/wso2/apk/common-controller/internal/utils" apkmgt "github.com/wso2/apk/common-go-libs/pkg/discovery/api/wso2/discovery/service/apkmgt" "google.golang.org/grpc/metadata" ) diff --git a/common-controller/internal/server/server.go b/common-controller/internal/server/server.go index 659e2ec6c..953560ee2 100644 --- a/common-controller/internal/server/server.go +++ b/common-controller/internal/server/server.go @@ -94,3 +94,8 @@ func DeleteSubscription(subscriptionUUID string) { func DeleteApplicationMapping(applicationMappingUUID string) { delete(applicationMappingMap, applicationMappingUUID) } + +// GetApplicationMappingFromStore returns an application mapping from the application mapping list +func GetApplicationMappingFromStore(applicationMappingUUID string) ApplicationMapping { + return applicationMappingMap[applicationMappingUUID] +} diff --git a/common-controller/internal/utils/event_utils.go b/common-controller/internal/utils/event_utils.go index d4c916224..f6a157311 100644 --- a/common-controller/internal/utils/event_utils.go +++ b/common-controller/internal/utils/event_utils.go @@ -108,7 +108,7 @@ func SendDeleteSubscriptionEvent(subscriptionUUID string, subscriptionSpec cpv1a Type: constants.SubscriptionDeleted, TimeStamp: milliseconds, Subscription: &subscription.Subscription{ - Uuid: uuid.New().String(), + Uuid: subscriptionUUID, SubStatus: subscriptionSpec.SubscriptionStatus, Organization: subscriptionSpec.Organization, SubscribedApi: &subscription.SubscribedAPI{ @@ -139,7 +139,7 @@ func SendCreateApplicationMappingEvent(applicationMapping cpv1alpha2.Application } // SendDeleteApplicationMappingEvent sends an application mapping deletion event to the enforcer -func SendDeleteApplicationMappingEvent(applicationMappingUUID string, applicationMappingSpec cpv1alpha2.ApplicationMappingSpec) { +func SendDeleteApplicationMappingEvent(applicationMappingUUID string, applicationMappingSpec cpv1alpha2.ApplicationMappingSpec, organization string) { currentTime := time.Now() milliseconds := currentTime.UnixNano() / int64(time.Millisecond) event := subscription.Event{ @@ -150,6 +150,7 @@ func SendDeleteApplicationMappingEvent(applicationMappingUUID string, applicatio Uuid: applicationMappingUUID, ApplicationRef: applicationMappingSpec.ApplicationRef, SubscriptionRef: applicationMappingSpec.SubscriptionRef, + Organization: organization, }, } sendEvent(&event)