-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Service registration: Allow running Umbraco with different combinations of backoffice, website and delivery API (closes #21622) #21630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0d5cb9a
Add support for running website without backoffice.
AndyButland 9fda78a
Add support for running delivery API without website or backoffice.
AndyButland fe0b3c8
Reverted unncessary idempotent checks on individual builder extensions.
AndyButland 3ac3583
Integration tests for service registrations.
AndyButland 2ebf575
Integration HTTP tests for service registrations.
AndyButland 4955242
Tidy up and code review feedback.
AndyButland a1bb5a3
Merge branch 'main' into v17/bugfix/allow-run-without-backoffice
AndyButland f269a6d
Remove unnecessary null check.
AndyButland eb21e90
Merge branch 'main' into v17/bugfix/allow-run-without-backoffice
AndyButland bf8b9cf
Ensure models builder references are added to attempt to resolve the …
AndyButland File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/Umbraco.Cms.Api.Delivery/DependencyInjection/UmbracoApplicationBuilderExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| using Microsoft.AspNetCore.Builder; | ||
| using Umbraco.Cms.Web.Common.ApplicationBuilder; | ||
|
|
||
| namespace Umbraco.Extensions; | ||
|
|
||
| /// <summary> | ||
| /// <see cref="IApplicationBuilder" /> extensions for the Umbraco Delivery API. | ||
| /// </summary> | ||
| public static class DeliveryApiApplicationBuilderExtensions | ||
| { | ||
| /// <summary> | ||
| /// Sets up routes for the Umbraco Delivery API. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This method maps attribute-routed controllers including the Delivery API endpoints. | ||
| /// Call this when using <c>AddDeliveryApi()</c> without <c>AddBackOffice()</c>, as the | ||
| /// backoffice endpoints normally handle the controller mapping. | ||
| /// </remarks> | ||
| /// <param name="builder">The Umbraco endpoint builder context.</param> | ||
| /// <returns>The <see cref="IUmbracoEndpointBuilderContext" /> for chaining.</returns> | ||
| public static IUmbracoEndpointBuilderContext UseDeliveryApiEndpoints(this IUmbracoEndpointBuilderContext builder) | ||
| { | ||
| builder.EndpointRouteBuilder.MapControllers(); | ||
| return builder; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Umbraco.Core/DependencyInjection/IBackOfficeEnabledMarker.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| namespace Umbraco.Cms.Core.DependencyInjection; | ||
|
|
||
| /// <summary> | ||
| /// Marker interface indicating the backoffice is enabled. | ||
| /// Used to conditionally register Management API controllers and services. | ||
| /// </summary> | ||
| public interface IBackOfficeEnabledMarker { } | ||
|
|
||
| /// <summary> | ||
| /// Marker class implementation for <see cref="IBackOfficeEnabledMarker"/>. | ||
| /// </summary> | ||
| public sealed class BackOfficeEnabledMarker : IBackOfficeEnabledMarker { } |
14 changes: 14 additions & 0 deletions
14
src/Umbraco.Core/Security/NoopLocalLoginSettingProvider.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| namespace Umbraco.Cms.Core.Security; | ||
|
|
||
| /// <summary> | ||
| /// A default implementation of <see cref="ILocalLoginSettingProvider"/> that always allows local login. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This is used when the backoffice is not registered, as the backoffice provides its own implementation | ||
| /// that checks external login provider settings. | ||
| /// </remarks> | ||
| public sealed class NoopLocalLoginSettingProvider : ILocalLoginSettingProvider | ||
| { | ||
| /// <inheritdoc /> | ||
| public bool HasDenyLocalLogin() => false; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| namespace Umbraco.Cms.Core.Services; | ||
|
|
||
| /// <summary> | ||
| /// A default implementation of <see cref="IConflictingRouteService"/> that never reports conflicts. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This is used when the backoffice is not registered, as route conflict detection | ||
| /// is primarily relevant for backoffice controller routes. | ||
| /// </remarks> | ||
| public sealed class NoopConflictingRouteService : IConflictingRouteService | ||
| { | ||
| /// <inheritdoc /> | ||
| public bool HasConflictingRoutes(out string controllerName) | ||
| { | ||
| controllerName = string.Empty; | ||
| return false; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.