migrate admin panel to actual accs, configs, etc (closes #16 and #13)

This commit is contained in:
Lapis
2026-06-18 11:17:50 -04:00
parent 004f1921a6
commit 3794e6e0ab
33 changed files with 1552 additions and 1255 deletions
@@ -0,0 +1,24 @@
using System.Net.Http.Headers;
using Microsoft.AspNetCore.Components.Authorization;
namespace CannedNet.Admin.Services;
public class JwtBearerHandler : DelegatingHandler
{
private readonly AuthenticationStateProvider _authStateProvider;
public JwtBearerHandler(AuthenticationStateProvider authStateProvider)
{
_authStateProvider = authStateProvider;
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var state = await _authStateProvider.GetAuthenticationStateAsync();
var token = state.User.FindFirst("access_token")?.Value;
if (token != null)
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
return await base.SendAsync(request, cancellationToken);
}
}