fix(oidc apps): correctly remove last additional origin, redirect uri and post logout redirect uri (#9209)

# Which Problems Are Solved

A customer reached out to support, that the (last) `additional origin`
could not be removed. While testing / implementation it was discovered,
that the same applied to `redirect_uris` and `post_logout_redirect_uris`

# How the Problems Are Solved

- Correctly set the corresponding array to empty in the event so it can
be differentiated to `null` / not set in case of no change.

# Additional Changes

Replaced `reflect.DeepEqual` with `slices.Equal`

# Additional Context

- Reported to support
This commit is contained in:
Livio Spring
2025-01-22 08:37:37 +01:00
committed by GitHub
parent 1915d35605
commit c9aa5db2a5
2 changed files with 18 additions and 6 deletions

View File

@@ -284,6 +284,10 @@ func ChangeVersion(version domain.OIDCVersion) func(event *OIDCConfigChangedEven
func ChangeRedirectURIs(uris []string) func(event *OIDCConfigChangedEvent) {
return func(e *OIDCConfigChangedEvent) {
if uris == nil {
// explicitly set them to empty so we can differentiate "not set" in the event in case of no changes
uris = make([]string, 0)
}
e.RedirectUris = &uris
}
}
@@ -314,6 +318,10 @@ func ChangeAuthMethodType(authMethodType domain.OIDCAuthMethodType) func(event *
func ChangePostLogoutRedirectURIs(logoutRedirects []string) func(event *OIDCConfigChangedEvent) {
return func(e *OIDCConfigChangedEvent) {
if logoutRedirects == nil {
// explicitly set them to empty so we can differentiate "not set" in the event in case of no changes
logoutRedirects = make([]string, 0)
}
e.PostLogoutRedirectUris = &logoutRedirects
}
}
@@ -356,6 +364,10 @@ func ChangeClockSkew(clockSkew time.Duration) func(event *OIDCConfigChangedEvent
func ChangeAdditionalOrigins(additionalOrigins []string) func(event *OIDCConfigChangedEvent) {
return func(e *OIDCConfigChangedEvent) {
if additionalOrigins == nil {
// explicitly set them to empty so we can differentiate "not set" in the event in case of no changes
additionalOrigins = make([]string, 0)
}
e.AdditionalOrigins = &additionalOrigins
}
}