Browse Source

Add Contentful to the list of supported providers

pull/2346/head
Jerrie Pelser 1 year ago
committed by Kévin Chalet
parent
commit
a00470b926
  1. 15
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs
  2. 17
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml

15
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs

@ -1429,6 +1429,12 @@ public static partial class OpenIddictClientWebIntegrationHandlers
context.UserInfoResponse?.HasParameter("last_name") is true context.UserInfoResponse?.HasParameter("last_name") is true
=> $"{(string?) context.UserInfoResponse?["first_name"]} {(string?) context.UserInfoResponse?["last_name"]}", => $"{(string?) context.UserInfoResponse?["first_name"]} {(string?) context.UserInfoResponse?["last_name"]}",
// These providers don't return a username so one is created using the "firstName" and "lastName" nodes:
ProviderTypes.Contentful or ProviderTypes.Smartsheet
when context.UserInfoResponse?.HasParameter("firstName") is true &&
context.UserInfoResponse?.HasParameter("lastName") is true
=> $"{(string?) context.UserInfoResponse?["firstName"]} {(string?) context.UserInfoResponse?["lastName"]}",
// FitBit returns the username as a custom "displayName" node: // FitBit returns the username as a custom "displayName" node:
ProviderTypes.Fitbit => (string?) context.UserInfoResponse?["displayName"], ProviderTypes.Fitbit => (string?) context.UserInfoResponse?["displayName"],
@ -1464,12 +1470,6 @@ public static partial class OpenIddictClientWebIntegrationHandlers
context.TokenResponse?["associated_user"]?["last_name"] is not null context.TokenResponse?["associated_user"]?["last_name"] is not null
=> $"{(string?) context.TokenResponse?["associated_user"]?["first_name"]} {(string?) context.TokenResponse?["associated_user"]?["last_name"]}", => $"{(string?) context.TokenResponse?["associated_user"]?["first_name"]} {(string?) context.TokenResponse?["associated_user"]?["last_name"]}",
// Smartsheet doesn't return a username so one is created using the "firstName" and "lastName" nodes:
ProviderTypes.Smartsheet
when context.UserInfoResponse?.HasParameter("firstName") is true &&
context.UserInfoResponse?.HasParameter("lastName") is true
=> $"{(string?) context.UserInfoResponse?["firstName"]} {(string?) context.UserInfoResponse?["lastName"]}",
// These providers return the username as a custom "display_name" node: // These providers return the username as a custom "display_name" node:
ProviderTypes.Spotify or ProviderTypes.StackExchange or ProviderTypes.Spotify or ProviderTypes.StackExchange or
ProviderTypes.Yandex or ProviderTypes.Zoom ProviderTypes.Yandex or ProviderTypes.Zoom
@ -1534,6 +1534,9 @@ public static partial class OpenIddictClientWebIntegrationHandlers
// Calendly returns the user identifier (formatted as a URI) as a custom "uri" node: // Calendly returns the user identifier (formatted as a URI) as a custom "uri" node:
ProviderTypes.Calendly => (string?) context.UserInfoResponse?["uri"], ProviderTypes.Calendly => (string?) context.UserInfoResponse?["uri"],
// Contentful returns the user identifier as a custom "sys/id" node:
ProviderTypes.Contentful => (string?) context.UserInfoResponse?["sys"]?["id"],
// DeviantArt returns the user identifier as a custom "userid" node: // DeviantArt returns the user identifier as a custom "userid" node:
ProviderTypes.DeviantArt => (string?) context.UserInfoResponse?["userid"], ProviderTypes.DeviantArt => (string?) context.UserInfoResponse?["userid"],

17
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml

@ -431,6 +431,23 @@
Description="The User Pool ID" /> Description="The User Pool ID" />
</Provider> </Provider>
<!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ▄▄▀██ ▄▄▄ ██ ▀██ █▄▄ ▄▄██ ▄▄▄██ ▀██ █▄▄ ▄▄██ ▄▄▄██ ██ ██ █████
██ █████ ███ ██ █ █ ███ ████ ▄▄▄██ █ █ ███ ████ ▄▄███ ██ ██ █████
██ ▀▀▄██ ▀▀▀ ██ ██▄ ███ ████ ▀▀▀██ ██▄ ███ ████ █████▄▀▀▄██ ▀▀ ██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
-->
<Provider Name="Contentful" Id="3d820b1e-33c7-4934-a783-48745343d53b"
Documentation="https://www.contentful.com/developers/docs/extensibility/oauth/">
<Environment Issuer="https://be.contentful.com">
<Configuration AuthorizationEndpoint="https://be.contentful.com/oauth/authorize"
TokenEndpoint="https://be.contentful.com/oauth/token"
UserInfoEndpoint="https://api.contentful.com/users/me" />
</Environment>
</Provider>
<!-- <!--
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ▄▄▀█ ▄▄▀█▄ ▄██ █████ ███ ██ ▄▀▄ ██ ▄▄▄ █▄▄ ▄▄█▄ ▄██ ▄▄▄ ██ ▀██ ██ ██ ▄▄▀█ ▄▄▀█▄ ▄██ █████ ███ ██ ▄▀▄ ██ ▄▄▄ █▄▄ ▄▄█▄ ▄██ ▄▄▄ ██ ▀██ ██

Loading…
Cancel
Save