mirror of
https://gitee.com/dcren/openiddict-documentation.git
synced 2025-07-15 23:13:34 +08:00
Update the provider contribution guide to match the recent changes in the client sandbox
This commit is contained in:
parent
d590f5519d
commit
d41708daf6
@ -161,20 +161,22 @@ options.UseWebProviders()
|
|||||||
- Update `AuthenticationController.cs` to allow triggering challenges pointing to the new provider:
|
- Update `AuthenticationController.cs` to allow triggering challenges pointing to the new provider:
|
||||||
|
|
||||||
```csharp
|
```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...
|
// ... other providers...
|
||||||
"[provider name]" => "https://[provider issuer]/",
|
!string.Equals(provider, [provider name], StringComparison.Ordinal))
|
||||||
|
{
|
||||||
_ => null
|
return BadRequest();
|
||||||
};
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- Update `Index.cshtml` under `Views\Home` to include a login button for the new provider:
|
- Update `Index.cshtml` under `Views\Home` to include a login button for the new provider:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<a class="btn btn-lg btn-success" asp-controller="Authentication"
|
<button class="btn btn-lg btn-success" type="submit" name="provider" value="[provider name]">
|
||||||
asp-action="Login" asp-route-provider="[provider name]">Sign in using [provider name]</a>
|
Sign in using [provider name]
|
||||||
|
</button>
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
|
Loading…
Reference in New Issue
Block a user