Auth DB schema migration, ef design, auth

This commit is contained in:
femsci 2023-10-01 09:41:10 +02:00
parent a0d5df1c52
commit 5e4bfaa95e
Signed by: femsci
GPG key ID: 08F7911F0E650C67
22 changed files with 1106 additions and 38 deletions

View file

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http.Json;
using System.Threading.Tasks;
using Interlinked.Shared.Model;
namespace Interlinked.Core.Services;
public class UserManager
{
public UserManager(IServiceProvider serv)
{
_serv = serv;
}
private readonly IServiceProvider _serv;
public async Task InitAsync()
{
using var scope = _serv.CreateAsyncScope();
var resp = await scope.ServiceProvider.GetRequiredService<HttpClient>().GetAsync("/api/auth/userdata");
if (resp.StatusCode == HttpStatusCode.OK)
{
User = (await resp.Content.ReadFromJsonAsync<UserModel>())!;
}
}
public UserModel User { get; set; } = default!;
public bool IsAuthorized => User != null;
}