You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.1 KiB
28 lines
1.1 KiB
// Copyright (c) Duende Software. All rights reserved.
|
|
// See LICENSE in the project root for license information.
|
|
|
|
namespace IdentitySvc.Pages.Login;
|
|
|
|
public class ViewModel
|
|
{
|
|
public bool AllowRememberLogin { get; set; } = true;
|
|
public bool EnableLocalLogin { get; set; } = true;
|
|
|
|
public IEnumerable<ViewModel.ExternalProvider> ExternalProviders { get; set; } = Enumerable.Empty<ExternalProvider>();
|
|
public IEnumerable<ViewModel.ExternalProvider> VisibleExternalProviders => ExternalProviders.Where(x => !String.IsNullOrWhiteSpace(x.DisplayName));
|
|
|
|
public bool IsExternalLoginOnly => EnableLocalLogin == false && ExternalProviders?.Count() == 1;
|
|
public string? ExternalLoginScheme => IsExternalLoginOnly ? ExternalProviders?.SingleOrDefault()?.AuthenticationScheme : null;
|
|
|
|
public class ExternalProvider
|
|
{
|
|
public ExternalProvider(string authenticationScheme, string? displayName = null)
|
|
{
|
|
AuthenticationScheme = authenticationScheme;
|
|
DisplayName = displayName;
|
|
}
|
|
|
|
public string? DisplayName { get; set; }
|
|
public string AuthenticationScheme { get; set; }
|
|
}
|
|
} |