Files
Aaru.Server/Aaru.Server.New/Components/Account/Shared/ExternalLoginPicker.razor

45 lines
1.4 KiB
Plaintext

@using Microsoft.AspNetCore.Authentication
@using Microsoft.AspNetCore.Identity
@inject SignInManager<IdentityUser> SignInManager
@inject IdentityRedirectManager RedirectManager
@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>
@foreach(AuthenticationScheme provider in externalLogins)
{
<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();
}
}