mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:47:33 +00:00
fix: relax parsing of SCIM user 'active' flag to improve compatibility (#9296)
# Which Problems Are Solved - Microsoft Entra invokes the user patch endpoint with `"active": "True"` / `"active": "False"` when patching a user. This is a well-known bug in MS Entra (see [here](https://learn.microsoft.com/en-us/entra/identity/app-provisioning/application-provisioning-config-problem-scim-compatibility)), but the bug fix has not landed yet and/or the feature flag does not work. # How the Problems Are Solved - To ensure compatibility with MS Entra, the parsing of the the boolean active flag of the scim user is relaxed and accepts strings in any casing that resolve to `true` or `false` as well as raw boolean values. # Additional Context Part of https://github.com/zitadel/zitadel/issues/8140
This commit is contained in:
@@ -39,7 +39,7 @@ type ScimUser struct {
|
||||
PreferredLanguage language.Tag `json:"preferredLanguage,omitempty"`
|
||||
Locale string `json:"locale,omitempty"`
|
||||
Timezone string `json:"timezone,omitempty"`
|
||||
Active *bool `json:"active,omitempty"`
|
||||
Active *scim_schemas.RelaxedBool `json:"active,omitempty"`
|
||||
Emails []*ScimEmail `json:"emails,omitempty" scim:"required"`
|
||||
PhoneNumbers []*ScimPhoneNumber `json:"phoneNumbers,omitempty"`
|
||||
Password *scim_schemas.WriteOnlyString `json:"password,omitempty"`
|
||||
|
@@ -273,7 +273,7 @@ func (h *UsersHandler) mapToScimUser(ctx context.Context, user *query.User, md m
|
||||
FamilyName: user.Human.LastName,
|
||||
GivenName: user.Human.FirstName,
|
||||
},
|
||||
Active: gu.Ptr(user.State.IsEnabled()),
|
||||
Active: schemas.NewRelaxedBool(user.State.IsEnabled()),
|
||||
}
|
||||
|
||||
if string(user.Human.Email) != "" {
|
||||
@@ -311,7 +311,7 @@ func (h *UsersHandler) mapWriteModelToScimUser(ctx context.Context, user *comman
|
||||
FamilyName: user.LastName,
|
||||
GivenName: user.FirstName,
|
||||
},
|
||||
Active: gu.Ptr(user.UserState.IsEnabled()),
|
||||
Active: schemas.NewRelaxedBool(user.UserState.IsEnabled()),
|
||||
}
|
||||
|
||||
if string(user.Email) != "" {
|
||||
|
@@ -7,7 +7,6 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/muhlemmer/gu"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/text/language"
|
||||
@@ -707,7 +706,7 @@ func TestOperationCollection_Apply(t *testing.T) {
|
||||
PreferredLanguage: language.MustParse("en-US"),
|
||||
Locale: "en-US",
|
||||
Timezone: "America/New_York",
|
||||
Active: gu.Ptr(true),
|
||||
Active: schemas.NewRelaxedBool(true),
|
||||
Emails: []*ScimEmail{
|
||||
{
|
||||
Value: "jeanie.pendleton@example.com",
|
||||
|
Reference in New Issue
Block a user