Posiadam w aplikacki .net 6 dwa controllery. Dlaczego z pierwszego mogę korzystać za pośrednictwem aplikacji frontendowej, a w przypadku drugiego mam kod błędu autoryzacji (401)?

/// PrintersAppService.cs

#nullable enable

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Authentication;
using System.Threading.Tasks;
using Abp.Application.Services.Dto;
using Abp.Auditing;
using Abp.Authorization;
using Abp.Runtime.Session;
using Medica.Authorization;
using Medica.Commerce.Printers.ApiModel;
using Medica.Commerce.Printers.Monitor;
using Medica.Commerce.VatSettings;
using Medica.Commerce.Visits.Payments;
using Medica.Common.Extensions;
using Medica.Files;

namespace Medica.Commerce.Printers;

[AbpAuthorize]
public class PrintersAppService : MedicaAppServiceBase, IPrintersAppService
{
    private readonly Lazy<IPrinterService> _service;
    private readonly Lazy<IPrinterMonitorService> _monitorService;
    private readonly Lazy<IPrinterProxy> _printerProxy;
    private readonly Lazy<IFileService> _fileService;
    private readonly Lazy<IReceiptSummaryGenerator> _receiptSummaryGenerator;
    private readonly Lazy<IVatSettingsService> _vatSettingsService;

    public PrintersAppService(
        Lazy<IPrinterService> service,
        Lazy<IPrinterProxy> printerProxy,
        Lazy<IPrinterMonitorService> monitorService,
        Lazy<IFileService> fileService,
        Lazy<IReceiptSummaryGenerator> receiptSummaryGenerator, Lazy<IVatSettingsService> vatSettingsService)
    {
        _service = service;
        _printerProxy = printerProxy;
        _monitorService = monitorService;
        _fileService = fileService;
        _receiptSummaryGenerator = receiptSummaryGenerator;
        _vatSettingsService = vatSettingsService;
    }

    [DisableAuditing]
    [AbpAuthorize(PermissionNames.Reception_Printers)]
    public async Task<string> GetUserPrinterAsync()
    {
        if (MedicaSession.OrganizationUnitId is { } orgUnitId && MedicaSession.UserId is { } userId)
        {
            return (await _service.Value.GetUserPrinterId(userId, orgUnitId)) ?? string.Empty;
        }

        ;
        return string.Empty;
    }

    [AbpAuthorize(PermissionNames.Reception_Printers)]
    public async Task<string> SetUserPrinterAsync(EntityDto<string> dto)
    {
        if (MedicaSession.OrganizationUnitId is { } orgUnitId && MedicaSession.UserId is { } userId)
        {
            return (await _service.Value.SetUserPrinterId(userId, orgUnitId, dto.Id)).OrThrow() ?? string.Empty;
        }

        return string.Empty;
    }


    [AbpAuthorize(PermissionNames.Reception_Printers)]
    public async Task DiscardJobAsync(EntityDto<Guid> dto)
    {
        (await _service.Value.HandleFailedJob(dto.Id, PrinterJobStatus.Discarded)).OrThrow();
    }
    [AbpAuthorize(PermissionNames.Reception_Printers)]
    public async Task MarkJobAsCompletedAsync(EntityDto<Guid> dto)
    {
        (await _service.Value.HandleFailedJob(dto.Id, PrinterJobStatus.Completed)).OrThrow();
    }

    [AbpAuthorize(PermissionNames.Reception_Printers)]
    public async Task<RetryResponseDto> RetryJobAsync(EntityDto<Guid> dto)
    {
        if (MedicaSession is { OrganizationUnitId: { } orgUnitId, UserId: { } userId })
        {
            var result = (await _service.Value.RetryJob(userId, orgUnitId, dto.Id)).OrThrow();
            return PaymentConverters.ToRetryResponseDto(result);
        }

        throw new AuthenticationException("No user/org unit defined in session state");
    }

    [AbpAuthorize(PermissionNames.Reception_Printers)]
    public async Task<PrinterJobStatusDto> GetPrinterJobStatusAsync(Guid jobId)
    {
        var response = (await _service.Value.GetPrinterJobStatusAsync(jobId)).OrThrow();
        return PrintersConverters.ToPrinterJobStatusDto(response);
    }

    [DisableAuditing]
    [AbpAuthorize]
    public async Task<IList<PrinterDto>> GetPrintersAsync(bool allOrgUnits = false)
    {
        var query = PrinterQuery.Reception(allOrgUnits ? null : MedicaSession.GetOrganizationUnitId());
        var response = await _service.Value.GetPrintersAsync(query);
        return response.Select(PrintersConverters.ToPrinterDto).ToList();
    }

    [AbpAuthorize]
    public async Task<IList<PrinterDto>> SearchAsync(PrintersQueryDto dto)
    {
        var query = PrinterQuery.OrgUnit(dto.OrgUnitId) with { Target = dto.Target is { } target ? PrinterTarget.GetByEnumVal(target) : null };
        var response = await _service.Value.GetPrintersAsync(query);
        return response.Select(PrintersConverters.ToPrinterDto).ToList();
    }

    [AbpAuthorize]
    public Task<PrinterDto> GetPrinterAsync(string id, PrinterType printerType = PrinterType.UseDefault)
    {
        bool usePosnetService = false;

        switch (printerType)
        {
            case PrinterType.Legacy:
                usePosnetService = false;
                break;
            case PrinterType.Posnet:
                usePosnetService = true;
                break;
            case PrinterType.UseDefault:
                usePosnetService = false;
                break;
        }

        return _monitorService.Value.CheckPrinterAsync(id, usePosnetService)
            .MapAsync(PrintersConverters.ToPrinterDto)
            .OrThrow();
    }

    [AbpAuthorize(PermissionNames.Admin_Settings)]
    public Task<PrinterDto> RestartProxyAsync(EntityDto<string> dto) =>
        _service.Value.RestartProxy(dto.Id).MapAsync(PrintersConverters.ToPrinterDto).OrThrow();


    [AbpAuthorize(PermissionNames.Admin_Settings)]
    public async Task<IList<PrinterDto>> CheckAllAsync()
    {
        await _monitorService.Value.CheckAsync(MedicaSession.GetTenantId());
        var response = await _service.Value.GetPrintersAsync(PrinterQuery.Empty());
        return response.Select(PrintersConverters.ToPrinterDto).ToList();
    }


    [AbpAuthorize(PermissionNames.Reception_Printers)]
    public async Task<PagedResultDto<ReceiptDto>> SearchReceiptsAsync(ReceiptQueryDto queryDto)
    {
        var response = (await _service.Value.SearchAsync(PrintersConverters.ToReceiptQueryDomain(queryDto))).OrThrow();
        var printers = await _service.Value.GetPrintersAsync(PrinterQuery.Empty());
        var vatLevels = (await _vatSettingsService.Value.GetAllAsync()).Or(new List<VatLevel>());
        return response.MapPaged(v => PrintersConverters.ToReceiptDto(v, printers, vatLevels));
    }

    [AbpAuthorize(PermissionNames.Reception_Printers)]
    public Task<decimal> SearchReceiptsSumAsync(ReceiptQueryDto queryDto) =>
        _service.Value.SearchSumAsync(PrintersConverters.ToReceiptQueryDomain(queryDto)).OrThrow();

    [AbpAuthorize(PermissionNames.Reception_Printers)]
    public async Task<FileEntityDto> ReceiptsSummaryAsync(ReceiptQueryDto queryDto)
    {
        var response = (await _service.Value.SearchAsync(PrintersConverters.ToReceiptQueryDomain(queryDto))).OrThrow();
        var docBytes = (await _receiptSummaryGenerator.Value.GenerateAsync(response.Items)).OrThrow();
        return await _fileService.Value.SetTemporaryFileAsync(docBytes, ContentTypes.Xls);
    }

    [AbpAuthorize(PermissionNames.Admin_TestServices)]
    public async Task CustomCommandAsync(PrintCustomQueryDto queryDto)
    {
        (await _printerProxy.Value.CustomCommandAsync<GenericPrinterResponse>(queryDto.CmdParams, queryDto.Id)).OrThrow();
    }

    [AbpAuthorize(PermissionNames.Admin_TestServices)]
    public async Task CustomCommandNoParamsAsync(PrintCustomQueryNoParamsDto queryDto)
    {
        (await _printerProxy.Value.CustomCommandAsync<GenericPrinterResponse>(queryDto.Cmd, queryDto.Id)).OrThrow();
    }

    public enum PrinterType
    {
        Legacy,
        Posnet,
        UseDefault
    }
}

/// DownloadAppService.cs

#nullable enable

using Abp.Auditing;
using Abp.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;

namespace Medica.Download;

[DisableAuditing]
[AbpAuthorize]
[Route("api/download")]
public class DownloadAppService : MedicaControllerBase
{
    private readonly IHttpClientFactory _httpClientFactory;

    public DownloadAppService(IHttpClientFactory httpClientFactory)
    {
        _httpClientFactory = httpClientFactory;
    }

    [HttpGet("image")]
    public async Task<IActionResult> DownloadImage([FromQuery] string url)
    {
        if (string.IsNullOrWhiteSpace(url))
        {
            return BadRequest("URL nie może być pusty.");
        }

        if (!Uri.TryCreate(url, UriKind.Absolute, out Uri? uriResult) ||
            !(uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps))
        {
            return BadRequest("Nieprawidłowy format URL.");
        }

        try
        {
            var httpClient = _httpClientFactory.CreateClient();

            var response = await httpClient.GetAsync(url);

            if (!response.IsSuccessStatusCode)
            {
                return StatusCode((int)response.StatusCode, "Nie udało się pobrać obrazu.");
            }

            var content = await response.Content.ReadAsByteArrayAsync();

            var contentType = response.Content.Headers.ContentType?.ToString() ?? "application/octet-stream";

            var fileName = Path.GetFileName(uriResult.LocalPath);
            if (string.IsNullOrEmpty(fileName))
            {
                fileName = "downloaded_image";
            }

            return File(content, contentType, fileName);
        }
        catch
        {
            return StatusCode(500, "Wystąpił błąd podczas pobierania obrazu.");
        }
    }
}