From 804dcffb915c73c1c49038a37a7b72449fa06066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Sun, 25 Jun 2023 16:22:21 +0200 Subject: [PATCH] Add Kroger to the list of supported providers --- ...ctClientWebIntegrationHandlers.Userinfo.cs | 8 ++-- ...penIddictClientWebIntegrationProviders.xml | 47 +++++++++++++++++++ 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs index 51dd4646..29e741ae 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs @@ -292,6 +292,10 @@ public static partial class OpenIddictClientWebIntegrationHandlers ["accounts"] = context.Response["accounts"] }, + // Kroger and Twitter return a nested "data" object. + ProviderTypes.Kroger or ProviderTypes.Twitter => new(context.Response["data"]?.GetNamedParameters() ?? + throw new InvalidOperationException(SR.FormatID0334("data"))), + // Patreon returns a nested "attributes" object that is itself nested in a "data" node. ProviderTypes.Patreon => new(context.Response["data"]?["attributes"]?.GetNamedParameters() ?? throw new InvalidOperationException(SR.FormatID0334("data/attributes"))), @@ -313,10 +317,6 @@ public static partial class OpenIddictClientWebIntegrationHandlers let name = $"{parameter.Key}_{node.Key}" select new KeyValuePair(name, node.Value)), - // Twitter returns a nested "data" object. - ProviderTypes.Twitter => new(context.Response["data"]?.GetNamedParameters() ?? - throw new InvalidOperationException(SR.FormatID0334("data"))), - _ => context.Response }; diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml index 3dc93398..ab52bba1 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml @@ -484,6 +484,53 @@ Description="The URI used to access the Keycloak identity provider (including the realm, if applicable)" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +