TourIAm/TIAMWebApp/Shared/Services/AcWebSessionServiceClientBa...

36 lines
1.2 KiB
C#

using System.Net;
using AyCode.Interfaces.StorageHandlers;
using Microsoft.AspNetCore.Components.Authorization;
using TIAM.Models;
using TIAMWebApp.Shared.Application.Interfaces;
using TIAMWebApp.Shared.Application.Models;
namespace TIAMWebApp.Shared.Application.Services;
public abstract class AcWebSessionServiceClientBase(ISecureStorageHandler secureStorageHandler, AuthenticationStateProvider authStateProvider) : IAcWebSessionServiceClient
{
public string? SessionId { get; set; }
public SiteViewModel SiteViewModel { get; } = new();
public UserSessionModel? User { get; set; }
public IPAddress? IpAddress { get; set; }
public bool IsAuthenticated { get; set; } = false;
public bool IsDevAdmin { get; set; } = false;
public bool IsSysAdmin { get; set; } = false;
public virtual async Task ClearAll()
{
await secureStorageHandler.ClearAllSecureStorageAsync();
await authStateProvider.GetAuthenticationStateAsync();
SessionId = string.Empty;
User = null;
IpAddress = null;
IsAuthenticated = false;
IsDevAdmin = false;
IsSysAdmin = false;
SiteViewModel.ClearAll();
}
}