Table of Contents

BuildExternalClaims Method

Translates a plain OAuth2 provider's user-profile JSON into a claims object keyed by OIDC claim names, ready to be handed to TAuthResult.SetProfile.

Syntax

Unit: Sphinx.UpstreamClient

function BuildExternalClaims(UserInfo: TJObject; Emails: TJArray; Mapping: TStrings): TJObject;

Parameters

<-> Parameter Type Description
UserInfo TJObject The JSON object returned by the provider's user-info endpoint.
Emails TJArray Optional JSON array returned by a dedicated e-mails endpoint (e.g. GitHub's /user/emails). When present, its primary address (preferring verified ones) overrides the mapped email/email_verified.
Mapping TStrings The oidcClaim=sourceField mapping driving the translation. Only the listed claims are copied; numeric source values (e.g. GitHub's numeric id) are coerced to strings.

Returns

A newly created claims object owned by the caller.