From d41708daf6ff1eedddf01762be6bab3693f887a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Mon, 10 Oct 2022 17:03:07 +0200 Subject: [PATCH] Update the provider contribution guide to match the recent changes in the client sandbox --- guides/contributing-a-new-web-provider.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/guides/contributing-a-new-web-provider.md b/guides/contributing-a-new-web-provider.md index e0ac9a3..da7e526 100644 --- a/guides/contributing-a-new-web-provider.md +++ b/guides/contributing-a-new-web-provider.md @@ -161,20 +161,22 @@ options.UseWebProviders() - Update `AuthenticationController.cs` to allow triggering challenges pointing to the new provider: ```csharp -var issuer = provider switch -{ +// Note: OpenIddict always validates the specified provider name when handling the challenge operation, +// but the provider can also be validated earlier to return an error page or a special HTTP error code. +if (!string.Equals(provider, "Local", StringComparison.Ordinal) && // ... other providers... - "[provider name]" => "https://[provider issuer]/", - - _ => null -}; + !string.Equals(provider, [provider name], StringComparison.Ordinal)) +{ + return BadRequest(); +} ``` - Update `Index.cshtml` under `Views\Home` to include a login button for the new provider: ```html -Sign in using [provider name] + ``` > [!NOTE]