Realistic per-source auth implementation: each SCIM client carries a
JWT issued by AshAuthentication, and the JWT contains a custom
scim_source claim identifying which IdP the request is from.
This implementation:
- Verifies the JWT via
AshAuthentication.Jwt.verify/2(signature, expiry, JTI presence in the token resource — the same checksAshScim.Auth.AshAuthenticationTokendoes). - Confirms the token's
purposeclaim is"scim". - Reads the custom
scim_sourceclaim and stashes it on the conn viaAsh.PlugHelpers.set_context/2so the router threads it through every Ash call. - Resolves the JWT subject into a service-account user record, used as the Ash actor for the request.
The router never sees scim_source — it just merges whatever context
the auth implementation set. The resource's change and prepare
modules read context.private.scim_source to enforce per-source
isolation.