6e2decd21f
Implement LdapFormViewModel for editing LDAP configuration section with properties for ServerUrlsText, GroupDn, SearchBase, ConnectionTimeoutSeconds, UseFakeAuth, and AdminBypassUsersText. Array properties use newline-separated text with StringSplitOptions.RemoveEmptyEntries | TrimEntries for splitting.
53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using JdeScoping.ConfigManager.Models;
|
|
|
|
namespace JdeScoping.ConfigManager.ViewModels.Forms;
|
|
|
|
/// <summary>
|
|
/// ViewModel for editing Auth configuration section.
|
|
/// </summary>
|
|
public class AuthFormViewModel : ViewModelBase
|
|
{
|
|
private readonly AuthSection _model;
|
|
private readonly Action _onChanged;
|
|
|
|
public AuthFormViewModel(AuthSection model, Action onChanged)
|
|
{
|
|
_model = model ?? throw new ArgumentNullException(nameof(model));
|
|
_onChanged = onChanged ?? throw new ArgumentNullException(nameof(onChanged));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the name of the authentication cookie.
|
|
/// </summary>
|
|
public string CookieName
|
|
{
|
|
get => _model.CookieName;
|
|
set
|
|
{
|
|
if (_model.CookieName != value)
|
|
{
|
|
_model.CookieName = value;
|
|
OnPropertyChanged();
|
|
_onChanged();
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the cookie expiration time in minutes.
|
|
/// </summary>
|
|
public int CookieExpirationMinutes
|
|
{
|
|
get => _model.CookieExpirationMinutes;
|
|
set
|
|
{
|
|
if (_model.CookieExpirationMinutes != value)
|
|
{
|
|
_model.CookieExpirationMinutes = value;
|
|
OnPropertyChanged();
|
|
_onChanged();
|
|
}
|
|
}
|
|
}
|
|
}
|