Skip to content

Commit b71a601

Browse files
docs: added documentation for data mapping of SAML attributes (#2078)
* added docs for data mapping of SAML provider * formatting * fixed typo * tweak to text * chore: apply suggestions from code review * code review suggestion Co-authored-by: Vincent <[email protected]> * code review suggestion Co-authored-by: Vincent <[email protected]> * format --------- Co-authored-by: Vincent <[email protected]>
1 parent 0c7f169 commit b71a601

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/kratos/organizations/organizations.mdx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,37 @@ curl -X PATCH --location "https://api.console.ory.sh/projects/$PROJECT_ID" \
348348

349349
The SAML application callback URL to set at our SAML Identity Provider is: `https://api.console.ory.sh/saml/api/oauth/saml`
350350

351+
#### Data mapping
352+
353+
You can configure the mapping of SAML attributes to Ory's identity schema using Jsonnet. All custom SAML attributes defined at the
354+
Identity Provider (IdP) will be available in the `raw_claims` object within `claims`. These attributes can then be mapped to the
355+
Ory identity schema.
356+
357+
:::warning
358+
359+
Ensure that the appropriate identity schema is created before mapping attributes. The email attribute is natively available in
360+
`claims.email`, everything else is nested under `claims.raw_claims`.
361+
362+
:::
363+
364+
#### Example SAML data mapping
365+
366+
Mapping `firstName` and `lastName` from the SAML Identity Provider to the Ory identity schema (traits).
367+
368+
```jsonnet
369+
local claims = std.extVar('claims');
370+
371+
{
372+
identity: {
373+
traits: {
374+
email: claims.email,
375+
[if std.objectHas(claims, "raw_claims") && std.objectHas(claims.raw_claims, "firstName") then "firstName" else null]: claims.raw_claims.firstName,
376+
[if std.objectHas(claims, "raw_claims") && std.objectHas(claims.raw_claims, "lastName") then "lastName" else null]: claims.raw_claims.lastName,
377+
},
378+
},
379+
}
380+
```
381+
351382
### SAML via BoxyHQ
352383

353384
:::note

0 commit comments

Comments
 (0)