From ff3f5efbc8ff73719edfcca5dbbe4d4cf27d85a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Sat, 4 Mar 2023 19:20:00 +0100 Subject: [PATCH] Allow JSON Web Keys that don't specify an explicit "use" and add Slack to the list of supported providers --- ...ddictClientWebIntegrationHandlers.Discovery.cs | 5 +++++ .../OpenIddictClientWebIntegrationHandlers.cs | 8 ++++++++ .../OpenIddictClientWebIntegrationProviders.xml | 15 +++++++++++++++ .../OpenIddictClientHandlers.Discovery.cs | 12 ++++++++---- .../OpenIddictValidationHandlers.Discovery.cs | 12 ++++++++---- 5 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Discovery.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Discovery.cs index 6c9de21f..1627e5cb 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Discovery.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.Discovery.cs @@ -110,6 +110,11 @@ public static partial class OpenIddictClientWebIntegrationHandlers context.Configuration.GrantTypesSupported.Add(GrantTypes.Implicit); } + else if (context.Registration.ProviderName is Providers.Slack) + { + context.Configuration.GrantTypesSupported.Add(GrantTypes.RefreshToken); + } + return default; } } diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs index dd830fd0..4bc71604 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationHandlers.cs @@ -710,6 +710,14 @@ public static partial class OpenIddictClientWebIntegrationHandlers context.Request["duration"] = options.Duration; } + // Slack allows sending an optional "team" parameter to simplify the login process. + else if (context.Registration.ProviderName is Providers.Slack) + { + var options = context.Registration.GetSlackOptions(); + + context.Request["team"] = options.Team; + } + return default; } } diff --git a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml index 764c7a98..61a5001f 100644 --- a/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml +++ b/src/OpenIddict.Client.WebIntegration/OpenIddictClientWebIntegrationProviders.xml @@ -345,6 +345,21 @@ Description="The value used as the 'duration' parameter (can be set to 'permanent' to retrieve a refresh token)" /> + + + + + + + +