jelhub / scimgateway

Using SCIM protocol as a gateway for user provisioning to other endpoints
MIT License
176 stars 57 forks source link

mssql plugin only accepts "work" email type #119

Closed phavekes closed 6 months ago

phavekes commented 6 months ago

When creating a new user, with other or home type email address, the mssql plugin returns an error, for other plugins, these values are accepted.

example of failing request:

curl --insecure --user user --header "Content-Type: application/json" \
                  --request POST \
                  --data '{
              "schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],
              "externalId":"xxxxxxxxxx",
              "name":{
                "familyName":"fam",
                "givenName":"given"
              },
              "displayName": "Goven Fam",
              "emails":[
                {
                  "type":"other",
                  "value":"user@example.com"
                }
              ]
            }' \
                https://x.y.z:8888/users
Enter host password for user 'user':
{"schemas":["urn:ietf:params:scim:api:messages:2.0:Error"],"scimType":"invalidSyntax","detail":"scimgateway[plugin-mssql] createUser error: Cannot read properties of undefined (reading 'value')","status":400}⏎ 

When changing the emails.type value to work the user is created successfully.

The value for email.work is hardcoded in https://github.com/jelhub/scimgateway/blob/0429ac32a192f0dadb9abea4dd3e0094fd9484e6/lib/plugin-mssql.js#L182

phavekes commented 6 months ago

Maybe related to #115

jelhub commented 6 months ago

Yes, plugin-mssql is an example plugin showing how to use and hardcode our own mapping attributes. You have to adjust mapping code for your needs. It does not use endpointMapper logic like plugin-entra-id and plugin-ldap