Add NoopCurrentMemberClaimsProvider so Umbraco can boot without the Delivery API enabled (#18049)

This commit is contained in:
Kenn Jacobsen
2025-01-21 09:10:43 +01:00
committed by Sven Geusens
parent 4b9771c0eb
commit 56c0aebd76
5 changed files with 10 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OpenIddict.Server.AspNetCore;
using Umbraco.Cms.Api.Delivery.Routing;
using Umbraco.Cms.Api.Delivery.Services;
using Umbraco.Cms.Core.DeliveryApi;
namespace Umbraco.Cms.Api.Delivery.Controllers.Security;

View File

@@ -1,4 +1,5 @@
using OpenIddict.Abstractions;
using Umbraco.Cms.Core.DeliveryApi;
using Umbraco.Cms.Core.Security;
namespace Umbraco.Cms.Api.Delivery.Services;

View File

@@ -1,4 +1,4 @@
namespace Umbraco.Cms.Api.Delivery.Services;
namespace Umbraco.Cms.Core.DeliveryApi;
public interface ICurrentMemberClaimsProvider
{

View File

@@ -0,0 +1,6 @@
namespace Umbraco.Cms.Core.DeliveryApi;
public class NoopCurrentMemberClaimsProvider : ICurrentMemberClaimsProvider
{
public Task<Dictionary<string, object>> GetClaimsAsync() => Task.FromResult(new Dictionary<string, object>());
}

View File

@@ -435,6 +435,7 @@ public static partial class UmbracoBuilderExtensions
builder.Services.AddSingleton<IRequestRedirectService, NoopRequestRedirectService>();
builder.Services.AddSingleton<IRequestPreviewService, NoopRequestPreviewService>();
builder.Services.AddSingleton<IRequestMemberAccessService, NoopRequestMemberAccessService>();
builder.Services.AddTransient<ICurrentMemberClaimsProvider, NoopCurrentMemberClaimsProvider>();
builder.Services.AddSingleton<IApiAccessService, NoopApiAccessService>();
builder.Services.AddSingleton<IApiContentQueryService, NoopApiContentQueryService>();
builder.Services.AddSingleton<IApiMediaQueryService, NoopApiMediaQueryService>();