diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs index 7fd7e9030..7ce9dcc82 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs @@ -1515,6 +1515,11 @@ ProviderTypes.Contentful or ProviderTypes.Smartsheet // HubSpot returns the username as a custom "user" node: ProviderTypes.HubSpot => (string?) context.UserInfoResponse?["user"], + + // ID Austria returns a "given_name" and "family_name" node + ProviderTypes.IdAustria when context.BackchannelIdentityTokenPrincipal?.HasClaim("given_name") is true && + context.BackchannelIdentityTokenPrincipal?.HasClaim("family_name") is true + => $"{context.BackchannelIdentityTokenPrincipal?.GetClaim("given_name")} {context.BackchannelIdentityTokenPrincipal?.GetClaim("family_name")}", // Mailchimp returns the username as a custom "accountname" node: ProviderTypes.Mailchimp => (string?) context.UserInfoResponse?["accountname"], @@ -1679,6 +1684,17 @@ ProviderTypes.Webflow or ProviderTypes.Weibo or ProviderTypes.Yandex context.MergedPrincipal.AddClaim(ClaimTypes.NameIdentifier, value, issuer); } } + + // Force override NameIdentifier claim for ID Austria + // In MapStandardWebServicesFederationClaims, Subject is mapped to NameIdentifier. + // ID Austria's documentation specifies the "sub" node to be a transient value, and refers + // to using their custom "bPK" for recognizing users across logins instead. + if (context.Registration.ProviderType is ProviderTypes.IdAustria) + { + context.MergedPrincipal.SetClaim(ClaimTypes.NameIdentifier, + context.BackchannelIdentityTokenPrincipal?.GetClaim("urn:pvpgvat:oidc.bpk") ?? + context.FrontchannelIdentityTokenPrincipal?.GetClaim("urn:pvpgvat:oidc.bpk")); + } return ValueTask.CompletedTask; } diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml index 5259939ad..1deff0f3d 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml @@ -1225,6 +1225,26 @@ + + + + + + + + + + + +