mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
29 lines
778 B
C#
29 lines
778 B
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Remotely.Server.Services;
|
|
using Remotely.Shared.Models;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Remotely.Server.Components;
|
|
|
|
public class AuthComponentBase : ComponentBase
|
|
{
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
IsAuthenticated = await AuthService.IsAuthenticated();
|
|
User = await AuthService.GetUser();
|
|
Username = User?.UserName;
|
|
await base.OnInitializedAsync();
|
|
}
|
|
|
|
public bool IsAuthenticated { get; private set; }
|
|
|
|
public RemotelyUser User { get; private set; }
|
|
|
|
public string Username { get; private set; }
|
|
|
|
[Inject]
|
|
protected IAuthService AuthService { get; set; }
|
|
}
|