Browse Source

Add Kroger to the list of supported providers

pull/1817/head
Kévin Chalet 3 years ago
parent
commit
804dcffb91
  1. 8
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs
  2. 47
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml

8
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<string, OpenIddictParameter>(name, node.Value)),
// Twitter returns a nested "data" object.
ProviderTypes.Twitter => new(context.Response["data"]?.GetNamedParameters() ??
throw new InvalidOperationException(SR.FormatID0334("data"))),
_ => context.Response
};

47
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)" />
</Provider>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ █▀▄██ ▄▄▀██ ▄▄▄ ██ ▄▄ ██ ▄▄▄██ ▄▄▀██
██ ▄▀███ ▀▀▄██ ███ ██ █▀▀██ ▄▄▄██ ▀▀▄██
██ ██ ██ ██ ██ ▀▀▀ ██ ▀▀▄██ ▀▀▀██ ██ ██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
-->
<Provider Name="Kroger" Id="18d33123-6b95-4f73-89a4-6e3ecbaf79f0"
Documentation="https://developer.kroger.com/documentation/public/security/customer">
<Environment Name="Production" Issuer="https://www.kroger.com/">
<Configuration AuthorizationEndpoint="https://api.kroger.com/v1/connect/oauth2/authorize"
TokenEndpoint="https://api.kroger.com/v1/connect/oauth2/token"
UserinfoEndpoint="https://api.kroger.com/v1/identity/profile">
<GrantType Value="authorization_code" />
<GrantType Value="client_credentials" />
<GrantType Value="refresh_token" />
<TokenEndpointAuthMethod Value="client_secret_basic" />
</Configuration>
<!--
Note: Kroger requires sending the "profile.compact" scope to be able to use the userinfo endpoint.
-->
<Scope Name="profile.compact" Default="true" Required="true" />
</Environment>
<Environment Name="Certification" Issuer="https://www.kroger.com/">
<Configuration AuthorizationEndpoint="https://api-ce.kroger.com/v1/connect/oauth2/authorize"
TokenEndpoint="https://api-ce.kroger.com/v1/connect/oauth2/token"
UserinfoEndpoint="https://api-ce.kroger.com/v1/identity/profile">
<GrantType Value="authorization_code" />
<GrantType Value="client_credentials" />
<GrantType Value="refresh_token" />
<TokenEndpointAuthMethod Value="client_secret_basic" />
</Configuration>
<!--
Note: Kroger requires sending the "profile.compact" scope to be able to use the userinfo endpoint.
-->
<Scope Name="profile.compact" Default="true" Required="true" />
</Environment>
</Provider>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ████▄ ▄██ ▄▄▀██ ██ ██ ▄▄▄██ ▄▄▄ ██ ▄▄▄ ██

Loading…
Cancel
Save