I currently have an application where users belong organizations within the app. When a user wants to add someone else to their team, they need to define a role (admin, developer, etc.) for the new user. It is also possible for some organizations to have child orgs, and in those cases it is possible to add multiple roles to a user per child org. It is important to note that in our current setup roles must be defined on user creation (you can’t create a user with no roles). We are now developing a SCIM API for SSO support. My question is, is it possible to include that information on User create? Something like:
POST /Users
{
"schemas": [...],
"id": 123...,
"groups": [
{
"value": org_id_1,
"role": "admin",
},
{
"value": org_id_2,
"role": "support",
},
...,
],
}
And then this would add the roles appropriately.
2
Answers
I would base a solution on the SCIM 2.0 Core Schema from RFC 6743. By default a user request payload where the user is assigned roles might look like this:
The Full User Representation Example provides a more complex groups example.
A good general approach is to follow the spec where you can, but the schema is meant to be extensible. So introduce your own field names or data shapes when the standard schema does not meet your needs. Perhaps give these names like
product_groups
.A SCIM 2.0 API should be provided out of the box if using OAuth 2.0 and an authorization server (AS). In your case you are acting as an AS and also dealing with multi-tenancy. In a real AS, calling such an API might require an access token with an
accounts
scope and atenant_id
claim.Yes, it is possible to create a user and assign groups in a single request. However, I believe should use (implement) the
/Bulk
endpoint instead of the/Users
endpoint.SCIM Playground provides an example. It shows the following request.