2024-05-03 22:54:50 +01:00
@using Microsoft.AspNetCore.Authentication
2024-05-02 07:43:47 +01:00
@using Microsoft.AspNetCore.Identity
2024-05-03 22:54:50 +01:00
@inject SignInManager<IdentityUser> SignInManager
@inject IdentityRedirectManager RedirectManager
2024-05-02 07:43:47 +01:00
@if(externalLogins.Length == 0)
{
<div>
<p>
There are no external authentication services configured. See this
<a href="https://go.microsoft.com/fwlink/?LinkID=532715">
article
about setting up this ASP.NET application to support logging in via external services
</a>.
</p>
</div>
}
else
{
<form action="Account/PerformExternalLogin" class="form-horizontal" method="post">
<div>
<AntiforgeryToken/>
<input name="ReturnUrl" type="hidden" value="@ReturnUrl"/>
<p>
2024-05-03 03:24:40 +01:00
@foreach(AuthenticationScheme provider in externalLogins)
2024-05-02 07:43:47 +01:00
{
<button class="btn btn-primary" name="provider" title="Log in using your @provider.DisplayName account" type="submit" value="@provider.Name">@provider.DisplayName</button>
}
</p>
</div>
</form>
}
@code {
private AuthenticationScheme[] externalLogins = [];
[SupplyParameterFromQuery]
private string? ReturnUrl { get; set; }
protected override async Task OnInitializedAsync()
{
externalLogins = (await SignInManager.GetExternalAuthenticationSchemesAsync()).ToArray();
}
}