Browse Source

Add Contentful to the list of supported providers

pull/2309/head
Jerrie Pelser 9 months ago
committed by GitHub
parent
commit
94a2d642d6
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 15
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs
  2. 17
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml

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

@ -1430,6 +1430,12 @@ public static partial class OpenIddictClientWebIntegrationHandlers
context.UserInfoResponse?.HasParameter("last_name") is true
=> $"{(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:
ProviderTypes.Fitbit => (string?) context.UserInfoResponse?["displayName"],
@ -1465,12 +1471,6 @@ public static partial class OpenIddictClientWebIntegrationHandlers
context.TokenResponse?["associated_user"]?["last_name"] is not null
=> $"{(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:
ProviderTypes.Spotify or ProviderTypes.StackExchange or
ProviderTypes.Yandex or ProviderTypes.Zoom
@ -1535,6 +1535,9 @@ public static partial class OpenIddictClientWebIntegrationHandlers
// Calendly returns the user identifier (formatted as a URI) as a custom "uri" node:
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:
ProviderTypes.DeviantArt => (string?) context.UserInfoResponse?["userid"],

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

@ -431,6 +431,23 @@
Description="The User Pool ID" />
</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