feat: introduce IConceptsMapService abstraction with server and WASM implementations and update knowledge processing flow

This commit is contained in:
2026-05-26 16:48:46 +02:00
parent 4fd66052ea
commit 44c4ad0903
9 changed files with 135 additions and 12 deletions
@@ -9,6 +9,7 @@ using NexusReader.Application.Queries.User;
using MediatR;
using NexusReader.Application.Constants;
using NexusReader.Application.Abstractions.Services;
using Microsoft.AspNetCore.Components.Authorization;
namespace NexusReader.Web.Services;
@@ -19,6 +20,7 @@ public class ServerIdentityService : IIdentityService
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IMediator _mediator;
private readonly INativeStorageService _storageService;
private readonly AuthenticationStateProvider _authStateProvider;
public event Func<Task>? OnStateInvalidated;
@@ -27,13 +29,15 @@ public class ServerIdentityService : IIdentityService
SignInManager<NexusUser> signInManager,
IHttpContextAccessor httpContextAccessor,
IMediator mediator,
INativeStorageService storageService)
INativeStorageService storageService,
AuthenticationStateProvider authStateProvider)
{
_userManager = userManager;
_signInManager = signInManager;
_httpContextAccessor = httpContextAccessor;
_mediator = mediator;
_storageService = storageService;
_authStateProvider = authStateProvider;
}
public async Task<Result> LoginAsync(string email, string password, bool rememberMe = false)
@@ -107,7 +111,14 @@ public class ServerIdentityService : IIdentityService
public async Task<Result<UserProfileDto>> GetProfileAsync()
{
var user = _httpContextAccessor.HttpContext?.User;
var authState = await _authStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user == null || !user.Identity?.IsAuthenticated == true)
{
user = _httpContextAccessor.HttpContext?.User;
}
if (user == null || !user.Identity?.IsAuthenticated == true) return Result.Fail("Not authenticated.");
var userId = user.FindFirstValue(ClaimTypes.NameIdentifier);