This sample signs in through FoxIDs using the OpenID Connect authorisation code flow. See the sample setup guide for the application registration and connection settings.
The sample can select authentication methods, send ordinary login parameters and send an impersonation parameter independently. These options are disabled by default. Merge the settings below into the existing IdentitySettings section in appsettings.json, keeping the authority, client and other connection settings. Start or restart the sample after changing these settings.
Set IdentitySettings:SendAuthMethodParameter to true and configure AuthMethod in appsettings.json:
"IdentitySettings": {
"SendAuthMethodParameter": true,
"AuthMethod": "login entra+work"
}Use your authentication methods' technical names, separated by spaces, and append +profile to select a profile. FoxIDs accepts up to four entries. The example is disabled by default and does not require Allowed request parameters.
On each sign-in, OnRedirectToIdentityProvider adds auth_method to the OIDC authorisation query string. The authority and issuer remain unchanged. The parameter can only select methods allowed by the configured authority URL. Names outside that selection, including *, are ignored with a warning; if no allowed methods remain, FoxIDs rejects the request.
The normal session and Home Realm Discovery flow still applies. Set SendAuthMethodParameter to false to use the authority URL's selection. See authentication method selection.
This example sends profile_id and a space-separated departments list with the OIDC authorisation request.
-
In FoxIDs Control, open this sample's OpenID Connect application registration, enable Show advanced, and add
profile_idanddepartmentsto Allowed request parameters. Each parameter must be configured in FoxIDs before it is available to claim transforms. -
Set
IdentitySettings:SendLoginParameterstotrueand configure the values to send:"IdentitySettings": { "SendLoginParameters": true, "LoginParameterProfileId": "16b66fb6-9f88-4a10-b489-8e54f48f76a4", "LoginParameterDepartments": "Sales Support" }
-
Start a new sign-in from the sample.
OnRedirectToIdentityProviderinProgram.csadds the parameters usingProtocolMessage.SetParameter. -
In FoxIDs, read
_local:params:profile_idand_local:params:departmentsfrom the authentication method's first-level claim transforms.
FoxIDs automatically splits values on spaces, so departments produces two claims: Sales and Support. Keep the list in one parameter occurrence. Across all parameters, FoxIDs accepts up to 10 values, 500 characters per value and 1,000 characters combined.
Set SendLoginParameters to false to stop sending these parameters. The configured values are sent on every OIDC sign-in while this setting is enabled.
This example sends impersonation_target_id as a reference to the user to impersonate. The reference can be an external profile ID or an internal user ID used by the configured target lookup.
-
Add
impersonation_target_idto Allowed request parameters in the sample's FoxIDs application registration. -
Enable the parameter and set the target user's reference:
"IdentitySettings": { "SendImpersonationParameter": true, "ImpersonationTargetId": "16b66fb6-9f88-4a10-b489-8e54f48f76a4" }
-
Configure the FoxIDs authentication method's claim transforms to read
_local:params:impersonation_target_id, check the authenticated user's permission to impersonate, load the target usingQuery internal useror a Claims API, check the target's eligibility, and select it with anImpersonationtransform. Follow the impersonation configuration example. -
To continue impersonation at later application logins, save the accepted target reference in
_session:impersonation_target_id. When the request parameter is absent, load the target using that saved reference and repeat the permission checks. -
Start a new sign-in from the sample. The configured reference is sent on every OIDC sign-in while
SendImpersonationParameteris enabled, independently ofSendLoginParameters.
To select another target, change ImpersonationTargetId and start a new sign-in. Setting SendImpersonationParameter to false stops sending the parameter. If FoxIDs retains the target reference in a session claim, the configured transforms can continue impersonation. To end it, the FoxIDs flow must clear the saved reference and complete without selecting a target.
Treat all parameters as browser input. Sending a target reference does not grant permission to impersonate. Avoid sending secrets in query parameters.