chore(manager): upgrade AuthBlocks to 10.3.33; migrate ITokenService → IAuthSession, SystemRoleConstants, hoist usings to _Imports
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
@page "/cms"
|
||||
@rendermode InteractiveServer
|
||||
@using AuthBlocksWeb.HierarchicalAuthorize
|
||||
@using AuthBlocksModels.SystemDefinitions
|
||||
@attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
|
||||
|
||||
<PageTitle>DeepDrft CMS</PageTitle>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
@page "/"
|
||||
@rendermode InteractiveServer
|
||||
@using AuthBlocksWeb.HierarchicalAuthorize
|
||||
@attribute [HierarchicalRoleAuthorize("Admin")]
|
||||
@attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
@code {
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
@page "/cms/tracks/{Id:int}"
|
||||
@using AuthBlocksWeb.HierarchicalAuthorize
|
||||
@using AuthBlocksWeb.Services
|
||||
@using System.Net.Http.Headers
|
||||
@using System.Net.Http.Json
|
||||
@attribute [HierarchicalRoleAuthorize("Admin")]
|
||||
@attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
|
||||
@inject ITrackService TrackService
|
||||
@inject IHttpClientFactory HttpClientFactory
|
||||
@inject ITokenService TokenService
|
||||
@inject IAuthSession AuthSession
|
||||
@inject ISnackbar Snackbar
|
||||
@inject IDialogService DialogService
|
||||
@inject NavigationManager Nav
|
||||
@@ -203,7 +201,7 @@
|
||||
|
||||
private async Task AttachBearerAsync(HttpClient http)
|
||||
{
|
||||
var token = await TokenService.GetAccessTokenAsync();
|
||||
var token = await AuthSession.GetValidTokenAsync();
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
@page "/cms/tracks"
|
||||
@using System.Net
|
||||
@using System.Net.Http.Headers
|
||||
@using AuthBlocksWeb.HierarchicalAuthorize
|
||||
@attribute [HierarchicalRoleAuthorize("Admin")]
|
||||
@attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
|
||||
@inject ITrackService TrackService
|
||||
@inject IHttpClientFactory HttpClientFactory
|
||||
@inject AuthBlocksWeb.Services.ITokenService TokenService
|
||||
@inject IAuthSession AuthSession
|
||||
@inject IDialogService DialogService
|
||||
@inject ISnackbar Snackbar
|
||||
@inject ILogger<TrackList> Logger
|
||||
@@ -115,7 +114,7 @@
|
||||
try
|
||||
{
|
||||
var client = HttpClientFactory.CreateClient("DeepDrft.API");
|
||||
var token = await TokenService.GetAccessTokenAsync();
|
||||
var token = await AuthSession.GetValidTokenAsync();
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var response = await client.DeleteAsync($"api/cms/track/{track.Id}");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
@page "/cms/tracks/new"
|
||||
@using System.Net.Http.Headers
|
||||
@using AuthBlocksWeb.HierarchicalAuthorize
|
||||
@attribute [HierarchicalRoleAuthorize("Admin")]
|
||||
@attribute [HierarchicalRoleAuthorize([SystemRoleConstants.Admin])]
|
||||
|
||||
@inject IHttpClientFactory HttpClientFactory
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
@using System.Net.Http.Headers
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@inject IHttpClientFactory HttpClientFactory
|
||||
@inject AuthBlocksWeb.Services.ITokenService TokenService
|
||||
@inject IAuthSession AuthSession
|
||||
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
@@ -51,7 +51,7 @@
|
||||
try
|
||||
{
|
||||
var client = HttpClientFactory.CreateClient("DeepDrft.API");
|
||||
var token = await TokenService.GetAccessTokenAsync();
|
||||
var token = await AuthSession.GetValidTokenAsync();
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var response = await client.DeleteAsync($"api/cms/track/{TrackId}");
|
||||
|
||||
@@ -14,3 +14,6 @@
|
||||
@using DeepDrftModels.Entities
|
||||
@using DeepDrftData
|
||||
@using Models.Common
|
||||
@using AuthBlocksModels.SystemDefinitions
|
||||
@using AuthBlocksWeb.HierarchicalAuthorize
|
||||
@using AuthBlocksWeb.Services
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.7" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.1" />
|
||||
<PackageReference Include="MudBlazor" Version="8.15.0" />
|
||||
<PackageReference Include="Cerebellum.AuthBlocks" Version="10.3.32" />
|
||||
<PackageReference Include="Cerebellum.AuthBlocks.Web" Version="10.3.32" />
|
||||
<PackageReference Include="Cerebellum.AuthBlocks" Version="10.3.33" />
|
||||
<PackageReference Include="Cerebellum.AuthBlocks.Web" Version="10.3.33" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user