Browse Source

Simplify Buffer provider configuration and claim mapping

pull/2553/head
dgates82 2 months ago
parent
commit
41ba85d653
  1. 8
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs
  2. 30
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs
  3. 4
      src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml

8
src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Userinfo.cs

@ -500,14 +500,8 @@ public static partial class OpenIddictClientWebIntegrationHandlers
Debug.Assert(context.Response is not null, SR.GetResourceString(SR.ID4007));
// Note: Buffer returns a non-standard "id" claim instead of "sub".
if (context.Registration.ProviderType is ProviderTypes.Buffer)
{
context.Response[Claims.Subject] = context.Response["id"];
}
// Note: Wikimedia returns a non-standard "sub" claim formatted as an integer instead of a string.
else if (context.Registration.ProviderType is ProviderTypes.Wikimedia)
if (context.Registration.ProviderType is ProviderTypes.Wikimedia)
{
context.Response[Claims.Subject] = (string?) context.Response[Claims.Subject];
}

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

@ -101,12 +101,6 @@ public static partial class OpenIddictClientWebIntegrationHandlers
// See https://github.com/openiddict/openiddict-core/issues/2428 for more information.
ProviderTypes.Google when context.Request.HasParameter(Parameters.Iss) &&
context.Configuration.AuthorizationResponseIssParameterSupported is not true => true,
// Buffer returns an "iss" authorization response parameter without advertising
// "authorization_response_iss_parameter_supported" in its (manually configured)
// provider metadata, since it doesn't expose an OAuth authorization server metadata document.
ProviderTypes.Buffer when context.Request.HasParameter(Parameters.Iss) &&
context.Configuration.AuthorizationResponseIssParameterSupported is not true => true,
_ => context.DisableIssuerParameterValidation
};
@ -1613,18 +1607,18 @@ public static partial class OpenIddictClientWebIntegrationHandlers
ProviderTypes.Atlassian => (string?) context.UserInfoResponse?["account_id"],
// These providers return the user identifier as a custom "id" node:
ProviderTypes.Airtable or ProviderTypes.Basecamp or ProviderTypes.Box or
ProviderTypes.Dailymotion or ProviderTypes.Deezer or ProviderTypes.Discord or
ProviderTypes.Disqus or ProviderTypes.Facebook or ProviderTypes.Figma or
ProviderTypes.Genesys or ProviderTypes.Gitee or ProviderTypes.GitHub or
ProviderTypes.Harvest or ProviderTypes.Kook or ProviderTypes.Kroger or
ProviderTypes.Lichess or ProviderTypes.Linear or ProviderTypes.Mastodon or
ProviderTypes.Meetup or ProviderTypes.Miro or ProviderTypes.Nextcloud or
ProviderTypes.Osu or ProviderTypes.Patreon or ProviderTypes.Pipedrive or
ProviderTypes.Reddit or ProviderTypes.Smartsheet or ProviderTypes.Spotify or
ProviderTypes.SubscribeStar or ProviderTypes.Todoist or ProviderTypes.Twitter or
ProviderTypes.Webflow or ProviderTypes.Weibo or ProviderTypes.Yandex or
ProviderTypes.Zoom
ProviderTypes.Airtable or ProviderTypes.Basecamp or ProviderTypes.Box or
ProviderTypes.Buffer or ProviderTypes.Dailymotion or ProviderTypes.Deezer or
ProviderTypes.Discord or ProviderTypes.Disqus or ProviderTypes.Facebook or
ProviderTypes.Figma or ProviderTypes.Genesys or ProviderTypes.Gitee or
ProviderTypes.GitHub or ProviderTypes.Harvest or ProviderTypes.Kook or
ProviderTypes.Kroger or ProviderTypes.Lichess or ProviderTypes.Linear or
ProviderTypes.Mastodon or ProviderTypes.Meetup or ProviderTypes.Miro or
ProviderTypes.Nextcloud or ProviderTypes.Osu or ProviderTypes.Patreon or
ProviderTypes.Pipedrive or ProviderTypes.Reddit or ProviderTypes.Smartsheet or
ProviderTypes.Spotify or ProviderTypes.SubscribeStar or ProviderTypes.Todoist or
ProviderTypes.Twitter or ProviderTypes.Webflow or ProviderTypes.Weibo or
ProviderTypes.Yandex or ProviderTypes.Zoom
=> (string?) context.UserInfoResponse?["id"],
// Bitbucket returns the user identifier as a custom "uuid" node:

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

@ -400,9 +400,9 @@
<Environment Issuer="https://auth.buffer.com/">
<Configuration AuthorizationEndpoint="https://auth.buffer.com/auth"
TokenEndpoint="https://auth.buffer.com/token"
UserInfoEndpoint="https://api.buffer.com">
UserInfoEndpoint="https://api.buffer.com/"
AuthorizationResponseIssParameterSupported="true">
<CodeChallengeMethod Value="S256" />
<TokenEndpointAuthMethod Value="client_secret_post" />
<GrantType Value="authorization_code" />
<GrantType Value="refresh_token" />
</Configuration>

Loading…
Cancel
Save