A source automatically creates claims from data captured by a factor, such as the email address a user signs up with or the profile claims returned by an identity provider. Configured as bidirectional, it also works the other way round: creating a claim enrolls the user in the factor.
capture-input, e.g. an email address) or Capture Claims event (capture-claims, the claims of an identity provider).source-claim) reports the result.Data is only captured when it's enabled on the factor (Capture Input or Capture Claims) and allowed in the request (capture_input / capture_claims, which default to true in the API; our Login UI asks the user first, see Interfaces — Consent & Data Notes):
| Factor | Captured Data (Claim) | When | Enabled By |
|---|---|---|---|
| Secret (username, email, phone, secret) | The input (input) | When an enrollment is created | Capture Input (config.capture_input), disabled by default |
| One-Time Password (OTP) | The email address or phone number (input) | When an enrollment is created | Storage Mode internal or external (config.storage_mode) |
| Identity Provider (IDP) | The claims returned by the provider (e.g. email, given_name) | At every login and signup | Capture Claims (config.capture_claims), disabled by default |
| Password, TOTP, JWT | - | - | Not supported |
attribute: string) - The ID of the attribute to create claims for. Required.factor: string) - The ID of the factor to capture data from. Required.claim: string) - Which value to use: input for the input captured by a secret or OTP factor, or the name of a claim of the identity provider, e.g. email or given_name. Nested claims (e.g. address.locality) aren't supported; source the whole address into a JSON attribute instead. Required.label: string) - Textual label for the source. Defaults to the attribute's label.status: string) - ENABLED or DISABLED. Only enabled sources are applied.config.bidirectional: boolean) - Whether creating a claim also enrolls the user in the factor, see Bidirectional. Only possible with claim input. Defaults to false.config.replace: boolean) - Whether a newly captured value replaces the claims this source captured before for the same enrollment, instead of being added next to them, see Replace. Defaults to true for picture attributes (url:oidc1:picture) and false for all others.Sources can be managed in the Admin UI, in the Sources tab of an attribute at https://{tenant_id}.admin.quasr.io/attributes/{attribute_id}/sources, or with the createSource, getSource, listSources, updateSource and deleteSource operations of the Management API:
mutation { createSource(input: { attribute: "{email_attribute_id}", factor: "{email_otp_factor_id}", claim: "input", label: "Email from OTP", status: ENABLED, config: { bidirectional: true } }) { id status }}In the Agent API the create-source, get-source, list-sources, update-source and delete-source tools are used, passing the source as source_input.
A sourced claim is ENABLED if the attribute doesn't require validation, or if the captured value is verified: e.g. an email address validated with an OTP, or an identity provider claim with {claim}_verified set to true (such as email_verified). Otherwise the claim is PENDING, and it's enabled automatically once the linked enrollment is validated (except for identity provider enrollments).
Following applies when the claim can't simply be created:
MISSING_CLAIM) or doesn't match the attribute's type or regex (INVALID_CLAIM): no claim is createdBy default every new value captured by a source is added as a new claim, so the user keeps all values ever captured, and all of them are included in tokens. For values where only the latest one matters, enable Replace on the source (enabled by default for sources on a picture attribute): after the new value is captured, the claims the source captured before for the same enrollment are removed, so the user keeps a single claim per enrollment.
delete-claim), unless another source or enrollment is linked to it too.Use it in particular for profile pictures (picture) from identity providers. Facebook returns a different, signed picture URL on every login, which would otherwise add a claim per login; Google returns a new URL whenever the user changes their picture. A picture URL always shows the user's current picture, so older picture claims have no value of their own.
picture if the factor's scope includes profile.A bidirectional source also works the other way round: when a claim is created for the attribute (e.g. by the user in the Account UI or by an admin), the user is enrolled in the source's factor with the claim's value, and the claim and enrollment are linked. For example, an email address added as attribute becomes an email OTP enrollment the user can log in with.
source-enrollment).For example, users log in with a username (score 1) and a password (score 2), and the email attribute has a bidirectional source to an email OTP factor (score 2). Someone who only knows the username can then, depending on the configuration:
| Email Attribute | Email OTP Factor | Result | Why |
|---|---|---|---|
| Score 1 | No validation required | Unsafe | Adding their own email address creates an enabled OTP enrollment, so they can log in with username + OTP (score 3). |
| Score 1 | Validation required, Allow Pending enabled | Unsafe | The OTP sent to their own address validates the pending enrollment during login. |
| Score 1 | Validation required, Allow Pending disabled (default) | Safe | The enrollment stays pending and can't be used to log in until the claim is validated. |
| Score 3 (full login) | Any | Safe | Only fully logged-in users can add an email address. |
| Restricted | Any | Safe | Users can't add the attribute themselves; only admins and the system can. |
In short: give the attribute a score of at least a full login or make it restricted, and keep Require Validation enabled and Allow Pending disabled on factors created from attributes.
A very common setup links one email attribute to two factors: an email OTP factor, which proves the user owns the address, and an email (username) factor, to identify the user by email. Configure it as follows:
input, bidirectional. The email address is captured when the user enrolls, and validated by the OTP.input). Users can't enroll in it themselves: the enrollment is created from the email claim, and enabled once the claim is validated with the OTP.An email address then flows through the setup as follows:
Links connect a claim with the source and enrollment it was sourced from (or created). They show where a claim came from, and are used to enable claims and enrollments together. OTP factors in internal storage mode also use the link to find the email address or phone number to send the OTP to.
Links can be retrieved with the getLink and listLinks operations of the Management API (get-link and list-links tools of the Agent API), and are shown in the Admin UI and Account UI. See View.
Deleting a source, claim or enrollment deletes its links, and deleting a factor deletes its sources. Claims and enrollments themselves are never deleted because their link or source is. Only a source with Replace enabled deletes claims, namely the ones it captured before.
An identity provider factor can refer to one of its sources (config.source), which is then checked on every login and signup with the provider. The provider must return the source's claim with a valid value, and if the attribute is unique, an identity whose value already belongs to another account can't sign up or be linked: the user has to log in to that existing account instead. This prevents users from ending up with two accounts for the same email address. See Factors — IDP for all scenarios and their responses.
input. The email address a user signs up with is stored as claim, and enabled once the OTP is validated. Make it bidirectional so email addresses users add in the Account UI can also be used to log in, taking the scores into account. See Email Setup.given_name for the given name attribute. See Factors — IDP.picture on the picture attribute (url:oidc1:picture) and keep Replace enabled (the default for picture attributes), so the user keeps a single, current picture claim. For Google, add profile to the factor's scope.All related events (capture-input, capture-claims, source-claim, source-enrollment) are listed in the event catalog.