Skip to content

Commit

Permalink
Add environment wise key support
Browse files Browse the repository at this point in the history
  • Loading branch information
senthalan committed Sep 27, 2023
1 parent 017d338 commit eca4c84
Show file tree
Hide file tree
Showing 16 changed files with 298 additions and 24 deletions.
1 change: 1 addition & 0 deletions adapter/internal/discovery/xds/marshaller.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ func marshalKeyMapping(keyMappingInternal *types.ApplicationKeyMapping) *subscri
TenantId: keyMappingInternal.TenantID,
TenantDomain: keyMappingInternal.TenantDomain,
Timestamp: keyMappingInternal.TimeStamp,
EnvId: keyMappingInternal.EnvID,
}
}

Expand Down
9 changes: 8 additions & 1 deletion adapter/internal/messaging/notification_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ func handleLifeCycleEvents(data []byte) {

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

logger.LoggerInternalMsg.Infof("Application Key Mapping event for the Consumer Key : %+v", applicationRegistrationEvent)

applicationKeyMapping := types.ApplicationKeyMapping{ApplicationID: applicationRegistrationEvent.ApplicationID,
ConsumerKey: applicationRegistrationEvent.ConsumerKey, KeyType: applicationRegistrationEvent.KeyType,
KeyManager: applicationRegistrationEvent.KeyManager, TenantID: -1, TenantDomain: applicationRegistrationEvent.TenantDomain,
TimeStamp: applicationRegistrationEvent.TimeStamp, ApplicationUUID: applicationRegistrationEvent.ApplicationUUID}
TimeStamp: applicationRegistrationEvent.TimeStamp, ApplicationUUID: applicationRegistrationEvent.ApplicationUUID,
EnvID: applicationRegistrationEvent.EnvID}

applicationKeyMappingReference := xds.GetApplicationKeyMappingReference(&applicationKeyMapping)

Expand Down Expand Up @@ -335,6 +340,8 @@ func handleApplicationEvents(data []byte, eventType string) {
return
}

logger.LoggerInternalMsg.Infof("Application Key Mapping event for the Consumer Key : %+v", applicationEvent)

app := types.Application{UUID: applicationEvent.UUID, ID: applicationEvent.ApplicationID,
Name: applicationEvent.ApplicationName, SubName: applicationEvent.Subscriber,
Policy: applicationEvent.ApplicationPolicy, TokenType: applicationEvent.TokenType,
Expand Down

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

1 change: 1 addition & 0 deletions adapter/pkg/eventhub/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type ApplicationKeyMapping struct {
ConsumerKey string `json:"consumerKey"`
KeyType string `json:"keyType"`
KeyManager string `json:"keyManager"`
EnvID string `json:"EnvId"`
TenantID int32 `json:"tenanId,omitempty"`
TenantDomain string `json:"tenanDomain,omitempty"`
TimeStamp int64 `json:"timeStamp,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions adapter/pkg/messaging/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ type ApplicationRegistrationEvent struct {
ConsumerKey string `json:"consumerKey"`
KeyType string `json:"keyType"`
KeyManager string `json:"keyManager"`
EnvID string `json:"EnvId"`
Event
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ message ApplicationKeyMapping {
string tenantDomain = 6;
int64 timestamp = 7;
string applicationUUID = 8;
string envId = 9;
}

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

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

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

Loading

0 comments on commit eca4c84

Please sign in to comment.