Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add environment wise key support #3439

Open
wants to merge 9 commits into
base: choreo
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public static class JwtTokenConstants {
public static final String ENV_NAME_PREFIX = "choreo:environment:";
public static final String PRODUCTION_KEY_TYPE = "PRODUCTION";
public static final String SANDBOX_KEY_TYPE = "SANDBOX";

public static final String DEFAULT_CHOREO_ENV_ID = "ALL";
}

/**
Expand Down
Loading
Loading