scim: match /Users results in "Resources" or "resources" (#15)
This PR has the SCIM matching logic support results from a SCIM `GET /Users` call being in `Resources` or `resources`. In practice, SCIM servers use both, due to inconsistency in the original specification. Closes #14.
This commit is contained in:
parent
b0f1e44617
commit
683d9222cb
@ -143,8 +143,12 @@ async function scimUserByEmail(
|
|||||||
headers: { Authorization: `Bearer ${app.scimBearerToken}` },
|
headers: { Authorization: `Bearer ${app.scimBearerToken}` },
|
||||||
});
|
});
|
||||||
const listBody = await listResponse.json();
|
const listBody = await listResponse.json();
|
||||||
if (listBody?.Resources?.length > 0) {
|
|
||||||
return listBody.Resources[0].id;
|
// in practice, SCIM servers put the results into either `resources` or
|
||||||
|
// `Resources`
|
||||||
|
const resources = listBody?.resources ?? listBody?.Resources ?? []
|
||||||
|
if (resources.length > 0) {
|
||||||
|
return resources[0].id;
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user