- Add JWT Bearer token validation to API Gateway with restricted CORS - Add cookie-based JWT validation to FileService for browser image requests - Create shared authentication infrastructure in FictionArchive.Service.Shared - Update frontend to set fa_session cookie after OIDC login - Add [Authorize] attributes to GraphQL mutations with role-based restrictions - Configure OIDC settings for both services in docker-compose Implements FA-17: Authentication for microservices architecture
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using FictionArchive.Service.NovelService.Models.Enums;
|
|
using FictionArchive.Service.NovelService.Models.IntegrationEvents;
|
|
using FictionArchive.Service.NovelService.Models.Localization;
|
|
using FictionArchive.Service.NovelService.Models.Novels;
|
|
using FictionArchive.Service.NovelService.Models.SourceAdapters;
|
|
using FictionArchive.Service.NovelService.Services;
|
|
using FictionArchive.Service.NovelService.Services.SourceAdapters;
|
|
using FictionArchive.Service.Shared.Services.EventBus;
|
|
using HotChocolate.Authorization;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace FictionArchive.Service.NovelService.GraphQL;
|
|
|
|
public class Mutation
|
|
{
|
|
[Authorize(Roles = "admin")]
|
|
public async Task<NovelUpdateRequestedEvent> ImportNovel(string novelUrl, NovelUpdateService service)
|
|
{
|
|
return await service.QueueNovelImport(novelUrl);
|
|
}
|
|
|
|
[Authorize]
|
|
public async Task<ChapterPullRequestedEvent> FetchChapterContents(uint novelId,
|
|
uint chapterNumber,
|
|
NovelUpdateService service)
|
|
{
|
|
return await service.QueueChapterPull(novelId, chapterNumber);
|
|
}
|
|
} |