chore(manager): upgrade AuthBlocks to 10.3.33; migrate ITokenService → IAuthSession, SystemRoleConstants, hoist usings to _Imports

This commit is contained in:
Daniel Harvey
2026-05-22 23:33:25 -04:00
parent 770baffb88
commit e73b3c3218
8 changed files with 15 additions and 19 deletions
@@ -1,7 +1,5 @@
@page "/cms" @page "/cms"
@rendermode InteractiveServer @rendermode InteractiveServer
@using AuthBlocksWeb.HierarchicalAuthorize
@using AuthBlocksModels.SystemDefinitions
@attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])] @attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
<PageTitle>DeepDrft CMS</PageTitle> <PageTitle>DeepDrft CMS</PageTitle>
+1 -2
View File
@@ -1,7 +1,6 @@
@page "/" @page "/"
@rendermode InteractiveServer @rendermode InteractiveServer
@using AuthBlocksWeb.HierarchicalAuthorize @attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
@attribute [HierarchicalRoleAuthorize("Admin")]
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@code { @code {
@@ -1,12 +1,10 @@
@page "/cms/tracks/{Id:int}" @page "/cms/tracks/{Id:int}"
@using AuthBlocksWeb.HierarchicalAuthorize
@using AuthBlocksWeb.Services
@using System.Net.Http.Headers @using System.Net.Http.Headers
@using System.Net.Http.Json @using System.Net.Http.Json
@attribute [HierarchicalRoleAuthorize("Admin")] @attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
@inject ITrackService TrackService @inject ITrackService TrackService
@inject IHttpClientFactory HttpClientFactory @inject IHttpClientFactory HttpClientFactory
@inject ITokenService TokenService @inject IAuthSession AuthSession
@inject ISnackbar Snackbar @inject ISnackbar Snackbar
@inject IDialogService DialogService @inject IDialogService DialogService
@inject NavigationManager Nav @inject NavigationManager Nav
@@ -203,7 +201,7 @@
private async Task AttachBearerAsync(HttpClient http) private async Task AttachBearerAsync(HttpClient http)
{ {
var token = await TokenService.GetAccessTokenAsync(); var token = await AuthSession.GetValidTokenAsync();
if (!string.IsNullOrEmpty(token)) if (!string.IsNullOrEmpty(token))
{ {
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
@@ -1,11 +1,10 @@
@page "/cms/tracks" @page "/cms/tracks"
@using System.Net @using System.Net
@using System.Net.Http.Headers @using System.Net.Http.Headers
@using AuthBlocksWeb.HierarchicalAuthorize @attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
@attribute [HierarchicalRoleAuthorize("Admin")]
@inject ITrackService TrackService @inject ITrackService TrackService
@inject IHttpClientFactory HttpClientFactory @inject IHttpClientFactory HttpClientFactory
@inject AuthBlocksWeb.Services.ITokenService TokenService @inject IAuthSession AuthSession
@inject IDialogService DialogService @inject IDialogService DialogService
@inject ISnackbar Snackbar @inject ISnackbar Snackbar
@inject ILogger<TrackList> Logger @inject ILogger<TrackList> Logger
@@ -115,7 +114,7 @@
try try
{ {
var client = HttpClientFactory.CreateClient("DeepDrft.API"); var client = HttpClientFactory.CreateClient("DeepDrft.API");
var token = await TokenService.GetAccessTokenAsync(); var token = await AuthSession.GetValidTokenAsync();
if (!string.IsNullOrEmpty(token)) if (!string.IsNullOrEmpty(token))
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var response = await client.DeleteAsync($"api/cms/track/{track.Id}"); var response = await client.DeleteAsync($"api/cms/track/{track.Id}");
@@ -1,7 +1,6 @@
@page "/cms/tracks/new" @page "/cms/tracks/new"
@using System.Net.Http.Headers @using System.Net.Http.Headers
@using AuthBlocksWeb.HierarchicalAuthorize @attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
@attribute [HierarchicalRoleAuthorize("Admin")]
@inject IHttpClientFactory HttpClientFactory @inject IHttpClientFactory HttpClientFactory
@inject NavigationManager Navigation @inject NavigationManager Navigation
@@ -2,7 +2,7 @@
@using System.Net.Http.Headers @using System.Net.Http.Headers
@using Microsoft.AspNetCore.Components @using Microsoft.AspNetCore.Components
@inject IHttpClientFactory HttpClientFactory @inject IHttpClientFactory HttpClientFactory
@inject AuthBlocksWeb.Services.ITokenService TokenService @inject IAuthSession AuthSession
<MudDialog> <MudDialog>
<DialogContent> <DialogContent>
@@ -51,7 +51,7 @@
try try
{ {
var client = HttpClientFactory.CreateClient("DeepDrft.API"); var client = HttpClientFactory.CreateClient("DeepDrft.API");
var token = await TokenService.GetAccessTokenAsync(); var token = await AuthSession.GetValidTokenAsync();
if (!string.IsNullOrEmpty(token)) if (!string.IsNullOrEmpty(token))
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var response = await client.DeleteAsync($"api/cms/track/{TrackId}"); var response = await client.DeleteAsync($"api/cms/track/{TrackId}");
@@ -14,3 +14,6 @@
@using DeepDrftModels.Entities @using DeepDrftModels.Entities
@using DeepDrftData @using DeepDrftData
@using Models.Common @using Models.Common
@using AuthBlocksModels.SystemDefinitions
@using AuthBlocksWeb.HierarchicalAuthorize
@using AuthBlocksWeb.Services
+2 -2
View File
@@ -12,8 +12,8 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.7" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.7" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.1" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.1" />
<PackageReference Include="MudBlazor" Version="8.15.0" /> <PackageReference Include="MudBlazor" Version="8.15.0" />
<PackageReference Include="Cerebellum.AuthBlocks" Version="10.3.32" /> <PackageReference Include="Cerebellum.AuthBlocks" Version="10.3.33" />
<PackageReference Include="Cerebellum.AuthBlocks.Web" Version="10.3.32" /> <PackageReference Include="Cerebellum.AuthBlocks.Web" Version="10.3.33" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>