mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-18 03:15:11 +00:00
chore: management console naming inconsistency (#11390)
# Which Problems Are Solved The following terms have all been renamed to management console: - Customer Portal (when used to mean the console) - Console - Admin Console # How the Problems Are Solved - Search & Replace smartly - Use Copilot for translation files Changes done to: backend + frontend codebase, docs, translations and protobufs (descriptions only) # Additional Context - Partially Closes #11279
This commit is contained in:
@@ -31,11 +31,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
zitadelProjectName = "ZITADEL"
|
||||
mgmtAppName = "Management-API"
|
||||
adminAppName = "Admin-API"
|
||||
authAppName = "Auth-API"
|
||||
consoleAppName = "Console"
|
||||
zitadelProjectName = "ZITADEL"
|
||||
mgmtAppName = "Management-API"
|
||||
adminAppName = "Admin-API"
|
||||
authAppName = "Auth-API"
|
||||
managementConsoleAppName = "Management Console"
|
||||
)
|
||||
|
||||
type InstanceSetup struct {
|
||||
@@ -140,7 +140,7 @@ type InstanceSetupFeatures struct {
|
||||
EnableBackChannelLogout *bool
|
||||
LoginV2 *InstanceSetupFeatureLoginV2
|
||||
PermissionCheckV2 *bool
|
||||
ConsoleUseV2UserApi *bool
|
||||
ManagementConsoleUseV2UserApi *bool
|
||||
EnableRelationalTables *bool
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ func (f *InstanceSetupFeatures) ToInstanceFeatures() (_ *InstanceFeatures, err e
|
||||
EnableBackChannelLogout: f.EnableBackChannelLogout,
|
||||
LoginV2: loginV2,
|
||||
PermissionCheckV2: f.PermissionCheckV2,
|
||||
ConsoleUseV2UserApi: f.ConsoleUseV2UserApi,
|
||||
ManagementConsoleUseV2UserApi: f.ManagementConsoleUseV2UserApi,
|
||||
EnableRelationalTables: f.EnableRelationalTables,
|
||||
}, nil
|
||||
}
|
||||
@@ -214,15 +214,15 @@ type SecretGenerators struct {
|
||||
}
|
||||
|
||||
type ZitadelConfig struct {
|
||||
instanceID string
|
||||
orgID string
|
||||
projectID string
|
||||
mgmtAppID string
|
||||
adminAppID string
|
||||
authAppID string
|
||||
consoleAppID string
|
||||
limitsID string
|
||||
restrictionsID string
|
||||
instanceID string
|
||||
orgID string
|
||||
projectID string
|
||||
mgmtAppID string
|
||||
adminAppID string
|
||||
authAppID string
|
||||
managementConsoleAppID string
|
||||
limitsID string
|
||||
restrictionsID string
|
||||
}
|
||||
|
||||
func (s *InstanceSetup) generateIDs(idGenerator id.Generator) (err error) {
|
||||
@@ -256,7 +256,7 @@ func (s *InstanceSetup) generateIDs(idGenerator id.Generator) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
s.zitadel.consoleAppID, err = idGenerator.Next()
|
||||
s.zitadel.managementConsoleAppID, err = idGenerator.Next()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -272,7 +272,7 @@ func (c *Commands) SetUpInstance(ctx context.Context, setup *InstanceSetup) (str
|
||||
if err := setup.generateIDs(c.idGenerator); err != nil {
|
||||
return "", "", nil, "", nil, err
|
||||
}
|
||||
ctx = contextWithInstanceSetupInfo(ctx, setup.zitadel.instanceID, setup.zitadel.projectID, setup.zitadel.consoleAppID, c.externalDomain, setup.DefaultLanguage)
|
||||
ctx = contextWithInstanceSetupInfo(ctx, setup.zitadel.instanceID, setup.zitadel.projectID, setup.zitadel.managementConsoleAppID, c.externalDomain, setup.DefaultLanguage)
|
||||
|
||||
validations, pat, machineKey, loginClientPat, err := setUpInstance(ctx, c, setup)
|
||||
if err != nil {
|
||||
@@ -310,9 +310,9 @@ func (c *Commands) SetUpInstance(ctx context.Context, setup *InstanceSetup) (str
|
||||
return setup.zitadel.instanceID, token, machineKey, loginClientToken, details, nil
|
||||
}
|
||||
|
||||
func contextWithInstanceSetupInfo(ctx context.Context, instanceID, projectID, consoleAppID, externalDomain string, defaultLanguage language.Tag) context.Context {
|
||||
func contextWithInstanceSetupInfo(ctx context.Context, instanceID, projectID, managementConsoleAppID, externalDomain string, defaultLanguage language.Tag) context.Context {
|
||||
return authz.WithDefaultLanguage(
|
||||
authz.WithConsole(
|
||||
authz.WithManagementConsole(
|
||||
authz.SetCtxData(
|
||||
http.WithRequestedHost(
|
||||
authz.WithInstanceID(
|
||||
@@ -323,7 +323,7 @@ func contextWithInstanceSetupInfo(ctx context.Context, instanceID, projectID, co
|
||||
authz.CtxData{ResourceOwner: instanceID},
|
||||
),
|
||||
projectID,
|
||||
consoleAppID,
|
||||
managementConsoleAppID,
|
||||
),
|
||||
defaultLanguage,
|
||||
)
|
||||
@@ -560,8 +560,8 @@ func setupMinimalInterfaces(commands *Commands, validations *[]preparation.Valid
|
||||
cnsl := &addOIDCApp{
|
||||
AddApp: AddApp{
|
||||
Aggregate: *projectAgg,
|
||||
ID: ids.consoleAppID,
|
||||
Name: consoleAppName,
|
||||
ID: ids.managementConsoleAppID,
|
||||
Name: managementConsoleAppName,
|
||||
},
|
||||
Version: domain.OIDCVersionV1,
|
||||
RedirectUris: []string{},
|
||||
@@ -616,7 +616,7 @@ func setupMinimalInterfaces(commands *Commands, validations *[]preparation.Valid
|
||||
),
|
||||
|
||||
commands.AddOIDCAppCommand(cnsl),
|
||||
SetIAMConsoleID(instanceAgg, &cnsl.ClientID, &ids.consoleAppID),
|
||||
SetIAMConsoleID(instanceAgg, &cnsl.ClientID, &ids.managementConsoleAppID),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -811,7 +811,7 @@ func (c *Commands) ChangeSystemConfig(ctx context.Context, externalDomain string
|
||||
if len(instanceValidations.Validations) == 0 {
|
||||
continue
|
||||
}
|
||||
ctx := authz.WithConsole(authz.WithInstanceID(ctx, instanceID), instanceValidations.ProjectID, instanceValidations.ConsoleAppID)
|
||||
ctx := authz.WithManagementConsole(authz.WithInstanceID(ctx, instanceID), instanceValidations.ProjectID, instanceValidations.ManagementConsoleAppID)
|
||||
cmds, err := preparation.PrepareCommands(ctx, c.eventstore.Filter, instanceValidations.Validations...)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -862,12 +862,12 @@ func SetIAMProject(a *instance.Aggregate, projectID string) preparation.Validati
|
||||
}
|
||||
}
|
||||
|
||||
// SetIAMConsoleID defines the command to set the clientID of the Console App onto the instance
|
||||
// SetIAMConsoleID defines the command to set the clientID of the Management Console App onto the instance
|
||||
func SetIAMConsoleID(a *instance.Aggregate, clientID, appID *string) preparation.Validation {
|
||||
return func() (preparation.CreateCommands, error) {
|
||||
return func(ctx context.Context, filter preparation.FilterToQueryReducer) ([]eventstore.Command, error) {
|
||||
return []eventstore.Command{
|
||||
instance.NewIAMConsoleSetEvent(ctx, &a.Aggregate, clientID, appID),
|
||||
instance.NewIAMManagementConsoleSetEvent(ctx, &a.Aggregate, clientID, appID),
|
||||
}, nil
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -117,40 +117,40 @@ func (c *Commands) addInstanceDomain(a *instance.Aggregate, instanceDomain strin
|
||||
events := []eventstore.Command{
|
||||
instance.NewDomainAddedEvent(ctx, &a.Aggregate, instanceDomain, generated),
|
||||
}
|
||||
consoleChangeEvent, err := c.updateConsoleRedirectURIs(ctx, filter, instanceDomain)
|
||||
managementConsoleChangeEvent, err := c.updateManagementConsoleRedirectURIs(ctx, filter, instanceDomain)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if consoleChangeEvent == nil {
|
||||
if managementConsoleChangeEvent == nil {
|
||||
return events, nil
|
||||
}
|
||||
return append(events, consoleChangeEvent), nil
|
||||
return append(events, managementConsoleChangeEvent), nil
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Commands) prepareUpdateConsoleRedirectURIs(instanceDomain string) preparation.Validation {
|
||||
func (c *Commands) prepareUpdateManagementConsoleRedirectURIs(instanceDomain string) preparation.Validation {
|
||||
return func() (preparation.CreateCommands, error) {
|
||||
if instanceDomain = strings.TrimSpace(instanceDomain); instanceDomain == "" {
|
||||
return nil, zerrors.ThrowInvalidArgument(nil, "INST-E3j3s", "Errors.Invalid.Argument")
|
||||
}
|
||||
return func(ctx context.Context, filter preparation.FilterToQueryReducer) ([]eventstore.Command, error) {
|
||||
consoleChangeEvent, err := c.updateConsoleRedirectURIs(ctx, filter, instanceDomain)
|
||||
managementConsoleChangeEvent, err := c.updateManagementConsoleRedirectURIs(ctx, filter, instanceDomain)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if consoleChangeEvent == nil {
|
||||
if managementConsoleChangeEvent == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return []eventstore.Command{
|
||||
consoleChangeEvent,
|
||||
managementConsoleChangeEvent,
|
||||
}, nil
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Commands) updateConsoleRedirectURIs(ctx context.Context, filter preparation.FilterToQueryReducer, instanceDomain string) (*project.OIDCConfigChangedEvent, error) {
|
||||
appWriteModel, err := getOIDCAppWriteModel(ctx, filter, authz.GetInstance(ctx).ProjectID(), authz.GetInstance(ctx).ConsoleApplicationID(), "")
|
||||
func (c *Commands) updateManagementConsoleRedirectURIs(ctx context.Context, filter preparation.FilterToQueryReducer, instanceDomain string) (*project.OIDCConfigChangedEvent, error) {
|
||||
appWriteModel, err := getOIDCAppWriteModel(ctx, filter, authz.GetInstance(ctx).ProjectID(), authz.GetInstance(ctx).ManagementConsoleApplicationID(), "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ func TestCommandSide_AddInstanceDomain(t *testing.T) {
|
||||
"INSTANCE",
|
||||
project.NewApplicationAddedEvent(context.Background(),
|
||||
&project.NewAggregate("project1", "org1").Aggregate,
|
||||
"consoleApplicationID",
|
||||
"managementConsoleApplicationID",
|
||||
"app",
|
||||
),
|
||||
),
|
||||
@@ -138,7 +138,7 @@ func TestCommandSide_AddInstanceDomain(t *testing.T) {
|
||||
project.NewOIDCConfigAddedEvent(context.Background(),
|
||||
&project.NewAggregate("projectID", "org1").Aggregate,
|
||||
domain.OIDCVersionV1,
|
||||
"consoleApplicationID",
|
||||
"managementConsoleApplicationID",
|
||||
"client1@project",
|
||||
"secret",
|
||||
[]string{"https://test.ch"},
|
||||
@@ -169,7 +169,7 @@ func TestCommandSide_AddInstanceDomain(t *testing.T) {
|
||||
),
|
||||
newOIDCAppChangedEventInstanceDomain(
|
||||
context.Background(),
|
||||
"consoleApplicationID",
|
||||
"managementConsoleApplicationID",
|
||||
"projectID",
|
||||
"org1",
|
||||
),
|
||||
|
||||
@@ -22,7 +22,7 @@ type InstanceFeatures struct {
|
||||
EnableBackChannelLogout *bool
|
||||
LoginV2 *feature.LoginV2
|
||||
PermissionCheckV2 *bool
|
||||
ConsoleUseV2UserApi *bool
|
||||
ManagementConsoleUseV2UserApi *bool
|
||||
EnableRelationalTables *bool
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func (m *InstanceFeatures) isEmpty() bool {
|
||||
m.EnableBackChannelLogout == nil &&
|
||||
m.LoginV2 == nil &&
|
||||
m.PermissionCheckV2 == nil &&
|
||||
m.ConsoleUseV2UserApi == nil &&
|
||||
m.ManagementConsoleUseV2UserApi == nil &&
|
||||
m.EnableRelationalTables == nil)
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ func (m *InstanceFeaturesWriteModel) Query() *eventstore.SearchQueryBuilder {
|
||||
feature_v2.InstanceEnableBackChannelLogout,
|
||||
feature_v2.InstanceLoginVersion,
|
||||
feature_v2.InstancePermissionCheckV2,
|
||||
feature_v2.InstanceConsoleUseV2UserApi,
|
||||
feature_v2.InstanceManagementConsoleUseV2UserApi,
|
||||
feature_v2.InstanceEnableRelationalTables,
|
||||
).
|
||||
Builder().ResourceOwner(m.ResourceOwner)
|
||||
@@ -115,9 +115,9 @@ func reduceInstanceFeature(features *InstanceFeatures, key feature.Key, value an
|
||||
case feature.KeyPermissionCheckV2:
|
||||
v := value.(bool)
|
||||
features.PermissionCheckV2 = &v
|
||||
case feature.KeyConsoleUseV2UserApi:
|
||||
case feature.KeyManagementConsoleUseV2UserApi:
|
||||
v := value.(bool)
|
||||
features.ConsoleUseV2UserApi = &v
|
||||
features.ManagementConsoleUseV2UserApi = &v
|
||||
case feature.KeyEnableRelationalTables:
|
||||
v := value.(bool)
|
||||
features.EnableRelationalTables = &v
|
||||
@@ -136,7 +136,7 @@ func (wm *InstanceFeaturesWriteModel) setCommands(ctx context.Context, f *Instan
|
||||
cmds = appendFeatureUpdate(ctx, cmds, aggregate, wm.EnableBackChannelLogout, f.EnableBackChannelLogout, feature_v2.InstanceEnableBackChannelLogout)
|
||||
cmds = appendFeatureUpdate(ctx, cmds, aggregate, wm.LoginV2, f.LoginV2, feature_v2.InstanceLoginVersion)
|
||||
cmds = appendFeatureUpdate(ctx, cmds, aggregate, wm.PermissionCheckV2, f.PermissionCheckV2, feature_v2.InstancePermissionCheckV2)
|
||||
cmds = appendFeatureUpdate(ctx, cmds, aggregate, wm.ConsoleUseV2UserApi, f.ConsoleUseV2UserApi, feature_v2.InstanceConsoleUseV2UserApi)
|
||||
cmds = appendFeatureUpdate(ctx, cmds, aggregate, wm.ManagementConsoleUseV2UserApi, f.ManagementConsoleUseV2UserApi, feature_v2.InstanceManagementConsoleUseV2UserApi)
|
||||
cmds = appendFeatureUpdate(ctx, cmds, aggregate, wm.EnableRelationalTables, f.EnableRelationalTables, feature_v2.InstanceEnableRelationalTables)
|
||||
return cmds
|
||||
}
|
||||
|
||||
@@ -111,13 +111,13 @@ func Test_reduceInstanceFeature(t *testing.T) {
|
||||
expected: &InstanceFeatures{PermissionCheckV2: gu.Ptr(true)},
|
||||
},
|
||||
{
|
||||
name: "console use v2 user api",
|
||||
name: "management console uses v2 user api",
|
||||
args: args{
|
||||
features: &InstanceFeatures{},
|
||||
key: feature.KeyConsoleUseV2UserApi,
|
||||
key: feature.KeyManagementConsoleUseV2UserApi,
|
||||
value: true,
|
||||
},
|
||||
expected: &InstanceFeatures{ConsoleUseV2UserApi: gu.Ptr(true)},
|
||||
expected: &InstanceFeatures{ManagementConsoleUseV2UserApi: gu.Ptr(true)},
|
||||
},
|
||||
{
|
||||
name: "enable relational tables",
|
||||
|
||||
@@ -123,12 +123,12 @@ func TestCommands_SetInstanceFeatures(t *testing.T) {
|
||||
expectPushFailed(io.ErrClosedPipe,
|
||||
feature_v2.NewSetEvent(
|
||||
ctx, aggregate,
|
||||
feature_v2.InstanceConsoleUseV2UserApi, true,
|
||||
feature_v2.InstanceManagementConsoleUseV2UserApi, true,
|
||||
),
|
||||
),
|
||||
),
|
||||
args: args{ctx, &InstanceFeatures{
|
||||
ConsoleUseV2UserApi: gu.Ptr(true),
|
||||
ManagementConsoleUseV2UserApi: gu.Ptr(true),
|
||||
}},
|
||||
wantErr: io.ErrClosedPipe,
|
||||
},
|
||||
|
||||
@@ -34,17 +34,17 @@ import (
|
||||
|
||||
func instanceSetupZitadelIDs() ZitadelConfig {
|
||||
return ZitadelConfig{
|
||||
instanceID: "INSTANCE",
|
||||
orgID: "ORG",
|
||||
projectID: "PROJECT",
|
||||
consoleAppID: "console-id",
|
||||
authAppID: "auth-id",
|
||||
mgmtAppID: "mgmt-id",
|
||||
adminAppID: "admin-id",
|
||||
instanceID: "INSTANCE",
|
||||
orgID: "ORG",
|
||||
projectID: "PROJECT",
|
||||
managementConsoleAppID: "console-id",
|
||||
authAppID: "auth-id",
|
||||
mgmtAppID: "mgmt-id",
|
||||
adminAppID: "admin-id",
|
||||
}
|
||||
}
|
||||
|
||||
func projectAddedEvents(ctx context.Context, instanceID, orgID, id, owner string, externalSecure bool) []eventstore.Command {
|
||||
func projectAddedEvents(ctx context.Context, instanceID, orgID, id string, externalSecure bool) []eventstore.Command {
|
||||
events := []eventstore.Command{
|
||||
project.NewProjectAddedEvent(ctx,
|
||||
&project.NewAggregate(id, orgID).Aggregate,
|
||||
@@ -63,14 +63,14 @@ func projectAddedEvents(ctx context.Context, instanceID, orgID, id, owner string
|
||||
events = append(events, apiAppEvents(ctx, orgID, id, "admin-id", "Admin-API")...)
|
||||
events = append(events, apiAppEvents(ctx, orgID, id, "auth-id", "Auth-API")...)
|
||||
|
||||
consoleAppID := "console-id"
|
||||
consoleClientID := "clientID"
|
||||
events = append(events, oidcAppEvents(ctx, orgID, id, consoleAppID, "Console", consoleClientID, externalSecure)...)
|
||||
managementConsoleAppID := "console-id"
|
||||
managementConsoleClientID := "clientID"
|
||||
events = append(events, oidcAppEvents(ctx, orgID, id, managementConsoleAppID, "Management Console", managementConsoleClientID, externalSecure)...)
|
||||
events = append(events,
|
||||
instance.NewIAMConsoleSetEvent(ctx,
|
||||
instance.NewIAMManagementConsoleSetEvent(ctx,
|
||||
&instance.NewAggregate(instanceID).Aggregate,
|
||||
&consoleClientID,
|
||||
&consoleAppID,
|
||||
&managementConsoleClientID,
|
||||
&managementConsoleAppID,
|
||||
),
|
||||
)
|
||||
return events
|
||||
@@ -170,23 +170,20 @@ func orgEvents(ctx context.Context, instanceID, orgID, name, projectID, defaultD
|
||||
instance.NewDefaultOrgSetEventEvent(ctx, &instanceAgg.Aggregate, orgID),
|
||||
}
|
||||
|
||||
owner := ""
|
||||
if machine {
|
||||
machineID := "USER-MACHINE"
|
||||
events = append(events, machineEvents(ctx, instanceID, orgID, machineID, "PAT")...)
|
||||
owner = machineID
|
||||
}
|
||||
if human {
|
||||
userID := "USER"
|
||||
events = append(events, humanEvents(ctx, instanceID, orgID, userID)...)
|
||||
owner = userID
|
||||
}
|
||||
if loginClient {
|
||||
userID := "USER-LOGIN-CLIENT"
|
||||
events = append(events, loginClientEvents(ctx, instanceID, orgID, userID, "LOGIN-CLIENT-PAT")...)
|
||||
}
|
||||
|
||||
events = append(events, projectAddedEvents(ctx, instanceID, orgID, projectID, owner, externalSecure)...)
|
||||
events = append(events, projectAddedEvents(ctx, instanceID, orgID, projectID, externalSecure)...)
|
||||
return events
|
||||
}
|
||||
|
||||
@@ -194,7 +191,7 @@ func orgIDs() []string {
|
||||
return slices.Concat([]string{"USER-MACHINE", "PAT", "USER", "USER-LOGIN-CLIENT", "LOGIN-CLIENT-PAT"}, projectClientIDs())
|
||||
}
|
||||
|
||||
func instancePoliciesFilters(instanceID string) []expect {
|
||||
func instancePoliciesFilters(_ string) []expect {
|
||||
return []expect{
|
||||
expectFilter(),
|
||||
expectFilter(),
|
||||
@@ -774,7 +771,6 @@ func TestCommandSide_setupMinimalInterfaces(t *testing.T) {
|
||||
"INSTANCE",
|
||||
"ORG",
|
||||
"PROJECT",
|
||||
"owner",
|
||||
false,
|
||||
)...,
|
||||
),
|
||||
@@ -1180,13 +1176,13 @@ func TestCommandSide_setupDefaultOrg(t *testing.T) {
|
||||
},
|
||||
},
|
||||
ids: ZitadelConfig{
|
||||
instanceID: "INSTANCE",
|
||||
orgID: "ORG",
|
||||
projectID: "PROJECT",
|
||||
consoleAppID: "console-id",
|
||||
authAppID: "auth-id",
|
||||
mgmtAppID: "mgmt-id",
|
||||
adminAppID: "admin-id",
|
||||
instanceID: "INSTANCE",
|
||||
orgID: "ORG",
|
||||
projectID: "PROJECT",
|
||||
managementConsoleAppID: "console-id",
|
||||
authAppID: "auth-id",
|
||||
mgmtAppID: "mgmt-id",
|
||||
adminAppID: "admin-id",
|
||||
},
|
||||
},
|
||||
res: res{
|
||||
@@ -1787,7 +1783,7 @@ func TestInstanceSetupFeatures_ToInstanceFeatures(t *testing.T) {
|
||||
EnableBackChannelLogout *bool
|
||||
LoginV2 *InstanceSetupFeatureLoginV2
|
||||
PermissionCheckV2 *bool
|
||||
ConsoleUseV2UserApi *bool
|
||||
ManagementConsoleUseV2UserApi *bool
|
||||
EnableRelationalTables *bool
|
||||
}
|
||||
|
||||
@@ -1816,7 +1812,7 @@ func TestInstanceSetupFeatures_ToInstanceFeatures(t *testing.T) {
|
||||
OIDCSingleV1SessionTermination: gu.Ptr(false),
|
||||
EnableBackChannelLogout: gu.Ptr(true),
|
||||
PermissionCheckV2: gu.Ptr(true),
|
||||
ConsoleUseV2UserApi: gu.Ptr(false),
|
||||
ManagementConsoleUseV2UserApi: gu.Ptr(false),
|
||||
EnableRelationalTables: gu.Ptr(true),
|
||||
},
|
||||
want: &InstanceFeatures{
|
||||
@@ -1829,7 +1825,7 @@ func TestInstanceSetupFeatures_ToInstanceFeatures(t *testing.T) {
|
||||
EnableBackChannelLogout: gu.Ptr(true),
|
||||
LoginV2: nil,
|
||||
PermissionCheckV2: gu.Ptr(true),
|
||||
ConsoleUseV2UserApi: gu.Ptr(false),
|
||||
ManagementConsoleUseV2UserApi: gu.Ptr(false),
|
||||
EnableRelationalTables: gu.Ptr(true),
|
||||
},
|
||||
},
|
||||
@@ -1886,7 +1882,7 @@ func TestInstanceSetupFeatures_ToInstanceFeatures(t *testing.T) {
|
||||
EnableBackChannelLogout: tc.fields.EnableBackChannelLogout,
|
||||
LoginV2: tc.fields.LoginV2,
|
||||
PermissionCheckV2: tc.fields.PermissionCheckV2,
|
||||
ConsoleUseV2UserApi: tc.fields.ConsoleUseV2UserApi,
|
||||
ManagementConsoleUseV2UserApi: tc.fields.ManagementConsoleUseV2UserApi,
|
||||
EnableRelationalTables: tc.fields.EnableRelationalTables,
|
||||
}
|
||||
got, err := f.ToInstanceFeatures()
|
||||
|
||||
@@ -193,12 +193,12 @@ func (m *mockInstance) ProjectID() string {
|
||||
return "projectID"
|
||||
}
|
||||
|
||||
func (m *mockInstance) ConsoleClientID() string {
|
||||
return "consoleID"
|
||||
func (m *mockInstance) ManagementConsoleClientID() string {
|
||||
return "managementConsoleID"
|
||||
}
|
||||
|
||||
func (m *mockInstance) ConsoleApplicationID() string {
|
||||
return "consoleApplicationID"
|
||||
func (m *mockInstance) ManagementConsoleApplicationID() string {
|
||||
return "managementConsoleApplicationID"
|
||||
}
|
||||
|
||||
func (m *mockInstance) DefaultLanguage() language.Tag {
|
||||
|
||||
@@ -123,7 +123,7 @@ func (s *OIDCSessionEvents) SetMilestones(ctx context.Context, clientID string,
|
||||
s.events = append(s.events, milestone.NewReachedEvent(ctx, aggregate, milestone.AuthenticationSucceededOnInstance))
|
||||
invalidate = true
|
||||
}
|
||||
if !milestones.AuthenticationSucceededOnApplication && isHuman && clientID != instance.ConsoleClientID() {
|
||||
if !milestones.AuthenticationSucceededOnApplication && isHuman && clientID != instance.ManagementConsoleClientID() {
|
||||
s.events = append(s.events, milestone.NewReachedEvent(ctx, aggregate, milestone.AuthenticationSucceededOnApplication))
|
||||
invalidate = true
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ func TestCommands_MilestonePushed(t *testing.T) {
|
||||
|
||||
func TestOIDCSessionEvents_SetMilestones(t *testing.T) {
|
||||
ctx := authz.WithInstanceID(context.Background(), "instanceID")
|
||||
ctx = authz.WithConsoleClientID(ctx, "console")
|
||||
ctx = authz.WithManagementConsoleClientID(ctx, "console")
|
||||
aggregate := milestone.NewAggregate(ctx)
|
||||
|
||||
type fields struct {
|
||||
|
||||
@@ -25,7 +25,7 @@ type systemConfigChangesInstanceModel struct {
|
||||
Domains []string
|
||||
GeneratedDomain string
|
||||
ProjectID string
|
||||
ConsoleAppID string
|
||||
ManagementConsoleAppID string
|
||||
RedirectUris []string
|
||||
PostLogoutRedirectUris []string
|
||||
}
|
||||
@@ -74,16 +74,16 @@ func (wm *SystemConfigWriteModel) Reduce() error {
|
||||
}
|
||||
case *instance.ProjectSetEvent:
|
||||
wm.Instances[e.Aggregate().InstanceID].ProjectID = e.ProjectID
|
||||
case *instance.ConsoleSetEvent:
|
||||
wm.Instances[e.Aggregate().InstanceID].ConsoleAppID = e.AppID
|
||||
case *instance.ManagementConsoleSetEvent:
|
||||
wm.Instances[e.Aggregate().InstanceID].ManagementConsoleAppID = e.AppID
|
||||
case *project.OIDCConfigAddedEvent:
|
||||
if wm.Instances[e.Aggregate().InstanceID].ConsoleAppID != e.AppID {
|
||||
if wm.Instances[e.Aggregate().InstanceID].ManagementConsoleAppID != e.AppID {
|
||||
continue
|
||||
}
|
||||
wm.Instances[e.Aggregate().InstanceID].RedirectUris = e.RedirectUris
|
||||
wm.Instances[e.Aggregate().InstanceID].PostLogoutRedirectUris = e.PostLogoutRedirectUris
|
||||
case *project.OIDCConfigChangedEvent:
|
||||
if wm.Instances[e.Aggregate().InstanceID].ConsoleAppID != e.AppID {
|
||||
if wm.Instances[e.Aggregate().InstanceID].ManagementConsoleAppID != e.AppID {
|
||||
continue
|
||||
}
|
||||
if e.RedirectUris != nil {
|
||||
@@ -107,7 +107,7 @@ func (wm *SystemConfigWriteModel) Query() *eventstore.SearchQueryBuilder {
|
||||
instance.InstanceDomainAddedEventType,
|
||||
instance.InstanceDomainRemovedEventType,
|
||||
instance.ProjectSetEventType,
|
||||
instance.ConsoleSetEventType,
|
||||
instance.ManagementConsoleSetEventType,
|
||||
).
|
||||
Or().
|
||||
AggregateTypes(project.AggregateType).
|
||||
@@ -119,10 +119,10 @@ func (wm *SystemConfigWriteModel) Query() *eventstore.SearchQueryBuilder {
|
||||
}
|
||||
|
||||
type SystemConfigChangesValidation struct {
|
||||
ProjectID string
|
||||
ConsoleAppID string
|
||||
Validations []preparation.Validation
|
||||
InstanceID string
|
||||
ProjectID string
|
||||
ManagementConsoleAppID string
|
||||
Validations []preparation.Validation
|
||||
InstanceID string
|
||||
}
|
||||
|
||||
func (wm *SystemConfigWriteModel) NewChangedEvents(commands *Commands) map[string]*SystemConfigChangesValidation {
|
||||
@@ -131,9 +131,9 @@ func (wm *SystemConfigWriteModel) NewChangedEvents(commands *Commands) map[strin
|
||||
cmds := make(map[string]*SystemConfigChangesValidation)
|
||||
for i, inst := range wm.Instances {
|
||||
cmds[i] = &SystemConfigChangesValidation{
|
||||
InstanceID: i,
|
||||
ProjectID: inst.ProjectID,
|
||||
ConsoleAppID: inst.ConsoleAppID,
|
||||
InstanceID: i,
|
||||
ProjectID: inst.ProjectID,
|
||||
ManagementConsoleAppID: inst.ManagementConsoleAppID,
|
||||
}
|
||||
//check each instance separately for changes (using the generated domain) and check if there's an existing custom domain
|
||||
newCustomDomainExists, isInstanceOfCustomDomain = wm.changeConfig(cmds[i], inst, commands)
|
||||
@@ -143,7 +143,7 @@ func (wm *SystemConfigWriteModel) NewChangedEvents(commands *Commands) map[strin
|
||||
}
|
||||
//handle the custom domain at last
|
||||
if newCustomDomainExists {
|
||||
//if the domain itself already exists, then only check if the uris of the console app exist as well
|
||||
// if the domain itself already exists, then only check if the uris of the Management Console app exist as well
|
||||
wm.changeURIs(cmds[instanceOfCustomDomain], wm.Instances[instanceOfCustomDomain], commands, wm.newExternalDomain)
|
||||
return cmds
|
||||
}
|
||||
@@ -171,7 +171,7 @@ func (wm *SystemConfigWriteModel) changeConfig(validation *SystemConfigChangesVa
|
||||
}
|
||||
}
|
||||
if newGeneratedDomainExists {
|
||||
//if the domain itself already exists, then only check if the uris of the console app exist as well
|
||||
// if the domain itself already exists, then only check if the uris of the Management Console app exist as well
|
||||
wm.changeURIs(validation, inst, commands, newGeneratedDomain)
|
||||
return newCustomDomainExists, isInstanceOfCustomDomain
|
||||
}
|
||||
@@ -181,5 +181,5 @@ func (wm *SystemConfigWriteModel) changeConfig(validation *SystemConfigChangesVa
|
||||
}
|
||||
|
||||
func (wm *SystemConfigWriteModel) changeURIs(validation *SystemConfigChangesValidation, inst *systemConfigChangesInstanceModel, commands *Commands, domain string) {
|
||||
validation.Validations = append(validation.Validations, commands.prepareUpdateConsoleRedirectURIs(domain))
|
||||
validation.Validations = append(validation.Validations, commands.prepareUpdateManagementConsoleRedirectURIs(domain))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user