mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 00:27:31 +00:00
fix: scim use first email or phone if no primary is set (#9236)
# Which Problems Are Solved - scim v2 only maps the primary phone/email to the zitadel user, this does not work if no primary is set # How the Problems Are Solved - the first phone / email is mapped if no primary is available # Additional Context Part of #8140 Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
This commit is contained in:
21
internal/api/scim/integration_test/testdata/users_create_test_no_primary_email_phone.json
vendored
Normal file
21
internal/api/scim/integration_test/testdata/users_create_test_no_primary_email_phone.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"schemas": [
|
||||
"urn:ietf:params:scim:schemas:core:2.0:User"
|
||||
],
|
||||
"userName": "acmeUser1",
|
||||
"name": {
|
||||
"familyName": "Ross",
|
||||
"givenName": "Bethany"
|
||||
},
|
||||
"emails": [
|
||||
{
|
||||
"value": "user1@example.com"
|
||||
}
|
||||
],
|
||||
"phoneNumbers": [
|
||||
{
|
||||
"value": "+41 71 123 45 67",
|
||||
"type": "work"
|
||||
}
|
||||
]
|
||||
}
|
@@ -33,6 +33,9 @@ var (
|
||||
//go:embed testdata/users_create_test_minimal_inactive.json
|
||||
minimalInactiveUserJson []byte
|
||||
|
||||
//go:embed testdata/users_create_test_no_primary_email_phone.json
|
||||
minimalNoPrimaryEmailPhoneUserJson []byte
|
||||
|
||||
//go:embed testdata/users_create_test_full.json
|
||||
fullUserJson []byte
|
||||
|
||||
@@ -196,6 +199,24 @@ func TestCreateUser(t *testing.T) {
|
||||
body: fullUserJson,
|
||||
want: fullUser,
|
||||
},
|
||||
{
|
||||
name: "no primary email and phone",
|
||||
body: minimalNoPrimaryEmailPhoneUserJson,
|
||||
want: &resources.ScimUser{
|
||||
Emails: []*resources.ScimEmail{
|
||||
{
|
||||
Value: "user1@example.com",
|
||||
Primary: true,
|
||||
},
|
||||
},
|
||||
PhoneNumbers: []*resources.ScimPhoneNumber{
|
||||
{
|
||||
Value: "+41711234567",
|
||||
Primary: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "missing userName",
|
||||
wantErr: true,
|
||||
|
Reference in New Issue
Block a user