imulab/go-scim

How to use extensions

alelb opened this issue · 3 comments

alelb commented

Hi @davidiamyou
I'm wondering through go-scim example trying to understand how to use extensions.

For instance, I would use enterpriseUser extension.

  1. Do I have to modify user_internal.json adding the fields of the extension or I have to create enterprise_user_internal.json?
  2. How can I reference the schema of the extension during the creation of the resource (validation, etc)?
  3. Do I have to create a new resource EnterpriseUser?

Please, can you provide a little example?

@alelb Please forgive me as I haven't come back to this project for a while. Details might have escaped me. For what I can recollect:

  1. Yes, you modify user_internal.json to add enterprise extension fields. This should simply be another complex object with nested fields.
  2. I see what you mean, but with regret, that is not built in yet. Basically, the validation process uses whatever is defined in user_internal.json or group_internal.json as the basis for validation. For now, you can work around by marking your enterprise extension object as optional. It will simply ignore it if not provided, but if it is, validation will be performed.
  3. No, you don't have to create a new resource called EnterpriseUser if all you want is to extend the User resource. Use cases for creating new resources are provided by SCIM, but I think people rarely use it anyways.

One concern is that enterprise extension fields usually come with a special name with urn (i.e. urn:com:foo:bar:employeeNumber), I can't recall if I have supported this use case in my Path Component If not supported, several other functions like querying would be broken. I will implement a test case to see if I have indeed implemented it later, but do let me know if you find out in advance. Thank you . :)

Hi @davidiamyou yes there is a problem with the Path Component here.

I locally have a fork of your project wich supports extensions URNs via a simple regex.

I'm going to open a PR today, and yes: also test case would be useful you're right. :)

Commit merged into development, closing this one now.