RFC 7643: Matching the right account with id and externalId in SCIM
The 2015 SCIM core schema distinguishes a provider identity from a client reference. A local example tests a display-name change and the same reference appearing at two providers.
Archive retrospective · Topic year 2015
In this article
A staff record and an application account can use different keys
A company directory can track one staff member while individual applications maintain separate accounts. Human resources uses its own personnel reference. Mail and wiki services issue their own account identifiers. The name displayed to other users may change after a correction or at the person’s request. Display text is useful for search and presentation, but using it as a permanent join can cause an integration to open a second account after a rename. The September 2015 SCIM core schema assigns different fields to these roles. An integration can retain the directory reference, the provider it called, and the identifier that provider assigned. Updating a display label and establishing which account belongs to the person then become separate decisions. The integration has an account mapping that can survive a change in presentation.
Which side supplies id and externalId?
Under RFC 7643, id is assigned by the SCIM service provider. It is stable and unique within that provider’s context, and a provider does not reassign it to a different resource. A provisioning client can supply externalId to carry a reference from its own system. That reference helps connect a SCIM resource to a record in a source directory. It does not imply that two services share an account namespace or that external references are globally unique. A company can naturally send the same staff reference to two applications. Systems with several providers or tenants can keep the context with the mapping. The important question when reading a saved identifier is which service issued it and which client reference, if any, accompanied it.
Run a change of name across two providers
The local Node.js exercise uses two synthetic provider records. Both carry the external reference HR-17 and both use u-100 as their provider identifier. The repeated values make the scope visible. These are different service records even though their example keys are identical. A copy of the mail record changes its display name and carries the same id and externalId. Searching the sample for the unscoped external reference returns two results. The provider and resource identifier together select a single record. When the identifier is absent, the example reports that somebody needs to review the mapping. The program ran on Node.js 24.19.0 and does not call a server or send updates. It tests the rule that links the records in the fixture.
import assert from 'node:assert/strict';
const rows = [
{ provider: 'mail', id: 'u-100', externalId: 'HR-17', displayName: 'Ada Y.' },
{ provider: 'wiki', id: 'u-100', externalId: 'HR-17', displayName: 'Ada Y.' },
];
const onProvider = (provider, id) =>
rows.find(row => row.provider === provider && row.id === id);
const changed = { ...onProvider('mail', 'u-100'), displayName: 'Ada Yılmaz' };
assert.equal(changed.id, 'u-100');
assert.equal(changed.externalId, 'HR-17');
assert.notEqual(changed.displayName, onProvider('mail', 'u-100').displayName);
assert.notEqual(onProvider('mail', 'u-100'), onProvider('wiki', 'u-100'));
const localMatches = rows.filter(row => row.externalId === 'HR-17');
assert.equal(localMatches.length, 2);
assert.equal(onProvider('mail', 'missing'), undefined);
console.log(JSON.stringify({displayNameChanged:true,externalMatches:2,missing:'review'}));
Display text and login names play different roles
The core user schema provides displayName for text shown to people. It also defines the separate userName attribute. A service may expose the latter as part of its login process. Testing a display-name change is different from checking how a provider handles a change of user name. The example changes the display label only. Two people can have the same display name, and a service can still preserve independent records for them if the integration uses their resource IDs. An account browser may let somebody search by display name, but a job that updates accounts must be able to identify the exact resource it selected. Two changes to names at the same service do not have to collide at the mapping level.
Review an absent mapping before deciding how to reconcile
A migration can leave more than one application account that appears to correspond to a staff reference. It helps to inspect where each candidate came from and which provider issued its identifier. If a saved provider ID no longer resolves, the link may be old, the account may not exist, or another system may have supplied an incorrect value. Automatically creating a second account on every missing lookup can turn a mapping problem into duplicate accounts. The local exercise marks the absent entry for review. An operational record can state the provider, the requested resource identifier and the attempt time. It can retain evidence about the mismatch without storing personal information unrelated to the investigation. This is especially useful when the same provisioning process talks to several services.
Pair the schema checks with HTTP integration tests
RFC 7643 defines the resource fields. RFC 7644, also published in 2015, defines the related HTTP protocol for operations such as queries and updates. Reading a known account from a service gives an integration a chance to compare the returned resource ID with the link it has stored. The local array test does not exercise any provider’s protocol implementation. Real integration tests can inspect resource types, permission scopes, filtering and the behavior of conditional updates. A read-only reconciliation pass can check existing mappings before an account operation changes records. The example makes one narrower result repeatable. Display text can change while two separately scoped account mappings keep their identities. The remaining checks depend on the actual provider and the operations the integration uses.
Reader discussion
How would you measure this development's real-world impact?
No comments yet. Be the first to contribute.
Write a comment