fast-toothbrush-97571
06/11/2024, 1:47 PMchilly-king-10285
06/11/2024, 1:47 PMchilly-king-10285
06/11/2024, 1:48 PMjsonnet local claims = std.extVar('claims'); { identity: { traits: { // Allowing unverified email addresses enables account // enumeration attacks, if the value is used for // verification or as a password login identifier. // // If connecting only to your organization (one tenant), claims.email is safe to use // if you haven't actively disabled e-mail verification during sign-up. // // The email might be empty if the account isn't linked to an email address. // For a human readable identifier, consider using the "preferred_username" claim. [if 'email' in claims then 'email' else null]: claims.email, }, }, }
This Jsonnet code snippet maps the email claim to the Ory Identity schema. It checks if the 'email' claim exists in the claims and if so, it assigns the email claim to the 'email' field in the identity traits. If the 'email' claim does not exist, it assigns null to the 'email' field. Please note that you should not save secrets such as API keys, credentials, or personal data directly in Jsonnet code snippets. Jsonnet code snippets used for data mapping aren't stored in an encrypted format in Ory Network. For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/social-signin/microsoft#data-mapping).