Initial commit: JDE Scoping Tool migration project

Set up repository with legacy .NET Framework 4.8 source (OLD/),
new .NET 10 Blazor solution (NEW/), OpenSpec specifications,
documentation, and project configuration.
This commit is contained in:
Joseph Doherty
2026-01-02 07:43:29 -05:00
commit 26ff8d9b4f
1761 changed files with 596509 additions and 0 deletions
@@ -0,0 +1,53 @@
using System.Text.Json;
using JdeScoping.Client.Models;
using Microsoft.JSInterop;
namespace JdeScoping.Client.Auth;
/// <summary>
/// Stores user info in browser sessionStorage via JS interop.
/// Uses sessionStorage (not localStorage) so it clears on browser close,
/// matching cookie session behavior.
/// </summary>
public class UserStorageService : IUserStorageService
{
private const string UserKey = "jdescoping_user";
private readonly IJSRuntime _jsRuntime;
public UserStorageService(IJSRuntime jsRuntime)
{
_jsRuntime = jsRuntime;
}
public async Task<UserInfoViewModel?> GetUserAsync()
{
try
{
var json = await _jsRuntime.InvokeAsync<string?>("jdeScopingInterop.getSessionStorage", UserKey);
if (string.IsNullOrEmpty(json))
{
return null;
}
return JsonSerializer.Deserialize<UserInfoViewModel>(json, new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
});
}
catch
{
return null;
}
}
public async Task SetUserAsync(UserInfoViewModel user)
{
var json = JsonSerializer.Serialize(user);
await _jsRuntime.InvokeVoidAsync("jdeScopingInterop.setSessionStorage", UserKey, json);
}
public async Task RemoveUserAsync()
{
await _jsRuntime.InvokeVoidAsync("jdeScopingInterop.removeSessionStorage", UserKey);
}
}