Skip to content

Commit eca4c84

Browse files
committed
Add environment wise key support
1 parent 017d338 commit eca4c84

File tree

16 files changed

+298
-24
lines changed

16 files changed

+298
-24
lines changed

adapter/internal/discovery/xds/marshaller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ func marshalKeyMapping(keyMappingInternal *types.ApplicationKeyMapping) *subscri
629629
TenantId: keyMappingInternal.TenantID,
630630
TenantDomain: keyMappingInternal.TenantDomain,
631631
Timestamp: keyMappingInternal.TimeStamp,
632+
EnvId: keyMappingInternal.EnvID,
632633
}
633634
}
634635

adapter/internal/messaging/notification_listener.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ func handleLifeCycleEvents(data []byte) {
287287

288288
// handleApplicationEvents to process application related events
289289
func handleApplicationEvents(data []byte, eventType string) {
290+
//todo Need to check this event handling.
291+
logger.LoggerInternalMsg.Infof("Application event type : %s", eventType)
290292
if strings.EqualFold(applicationRegistration, eventType) ||
291293
strings.EqualFold(removeApplicationKeyMapping, eventType) {
292294
var applicationRegistrationEvent msg.ApplicationRegistrationEvent
@@ -302,10 +304,13 @@ func handleApplicationEvents(data []byte, eventType string) {
302304
return
303305
}
304306

307+
logger.LoggerInternalMsg.Infof("Application Key Mapping event for the Consumer Key : %+v", applicationRegistrationEvent)
308+
305309
applicationKeyMapping := types.ApplicationKeyMapping{ApplicationID: applicationRegistrationEvent.ApplicationID,
306310
ConsumerKey: applicationRegistrationEvent.ConsumerKey, KeyType: applicationRegistrationEvent.KeyType,
307311
KeyManager: applicationRegistrationEvent.KeyManager, TenantID: -1, TenantDomain: applicationRegistrationEvent.TenantDomain,
308-
TimeStamp: applicationRegistrationEvent.TimeStamp, ApplicationUUID: applicationRegistrationEvent.ApplicationUUID}
312+
TimeStamp: applicationRegistrationEvent.TimeStamp, ApplicationUUID: applicationRegistrationEvent.ApplicationUUID,
313+
EnvID: applicationRegistrationEvent.EnvID}
309314

310315
applicationKeyMappingReference := xds.GetApplicationKeyMappingReference(&applicationKeyMapping)
311316

@@ -335,6 +340,8 @@ func handleApplicationEvents(data []byte, eventType string) {
335340
return
336341
}
337342

343+
logger.LoggerInternalMsg.Infof("Application Key Mapping event for the Consumer Key : %+v", applicationEvent)
344+
338345
app := types.Application{UUID: applicationEvent.UUID, ID: applicationEvent.ApplicationID,
339346
Name: applicationEvent.ApplicationName, SubName: applicationEvent.Subscriber,
340347
Policy: applicationEvent.ApplicationPolicy, TokenType: applicationEvent.TokenType,

adapter/pkg/discovery/api/wso2/discovery/subscription/application_key_mapping.pb.go

Lines changed: 22 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adapter/pkg/eventhub/types/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ type ApplicationKeyMapping struct {
6666
ConsumerKey string `json:"consumerKey"`
6767
KeyType string `json:"keyType"`
6868
KeyManager string `json:"keyManager"`
69+
EnvID string `json:"EnvId"`
6970
TenantID int32 `json:"tenanId,omitempty"`
7071
TenantDomain string `json:"tenanDomain,omitempty"`
7172
TimeStamp int64 `json:"timeStamp,omitempty"`

adapter/pkg/messaging/event_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ type ApplicationRegistrationEvent struct {
138138
ConsumerKey string `json:"consumerKey"`
139139
KeyType string `json:"keyType"`
140140
KeyManager string `json:"keyManager"`
141+
EnvID string `json:"EnvId"`
141142
Event
142143
}
143144

api/proto/wso2/discovery/subscription/application_key_mapping.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ message ApplicationKeyMapping {
1919
string tenantDomain = 6;
2020
int64 timestamp = 7;
2121
string applicationUUID = 8;
22+
string envId = 9;
2223
}

enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/subscription/ApplicationKeyMapping.java

Lines changed: 138 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/subscription/ApplicationKeyMappingOrBuilder.java

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

enforcer-parent/enforcer/src/main/gen/org/wso2/choreo/connect/discovery/subscription/ApplicationKeyMappingProto.java

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)