Skip to content

Commit 37aaf73

Browse files
authored
Merge branch 'main' into 409
2 parents 2d52d80 + c8ae4b6 commit 37aaf73

12 files changed

+190
-62
lines changed

.dockerignore

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
1-
# ignore all
2-
**
3-
4-
# Except src for building
5-
!./src/*
6-
!Directory.Build.props
7-
8-
# TODO : Remove this line when Docker Buildkit works in Windows
9-
!/.build/release/*
10-
111
# Ignore any App_Data folder
122
**/App_Data/
133

14-
# Ignore all prebuild
4+
# Ignore all built assets
155
**/[b|B]in/
166
**/[O|o]bj/

Dockerfile

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
FROM --platform=$BUILDPLATFORM golang:alpine AS build
1+
# TARGETARCH and TARGETOS are set automatically when --platform is provided.
2+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
23
ARG TARGETOS
3-
4-
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
54
LABEL stage=build-env
6-
WORKDIR /app
5+
WORKDIR /source
76

8-
# Copy and build
9-
COPY ./src /app
10-
COPY Directory.Build.props /
7+
# copy required files for building
8+
# .dockerignore excludes App_Data and binaries from these
9+
COPY ./src ./src
10+
COPY Directory.Build.props .
11+
COPY Directory.Packages.props .
1112

12-
RUN dotnet publish /app/OrchardCore.Cms.Web -c Release -o ./build/release --framework net8.0 /p:RunAnalyzers=false
13+
# build, results are placed in /app
14+
RUN dotnet publish src/OrchardCore.Cms.Web/OrchardCore.Cms.Web.csproj -c Release -o /app --framework net8.0 /p:RunAnalyzers=false
1315

14-
# Build runtime image
16+
# build runtime image
1517
FROM mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-1809 AS build_windows
1618
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS build_linux
1719
FROM build_${TARGETOS} AS aspnet
1820

1921
EXPOSE 80
20-
ENV ASPNETCORE_URLS http://+:80
22+
ENV ASPNETCORE_URLS=http://+:80
2123
WORKDIR /app
22-
COPY --from=build-env /app/build/release .
24+
COPY --from=build-env /app/ .
2325
ENTRYPOINT ["dotnet", "OrchardCore.Cms.Web.dll"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using Microsoft.AspNetCore.Authentication;
2+
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
3+
using Microsoft.Extensions.DependencyInjection;
4+
using Microsoft.Extensions.DependencyInjection.Extensions;
5+
using Microsoft.Extensions.Options;
6+
using Microsoft.Identity.Web;
7+
using OrchardCore.Deployment;
8+
using OrchardCore.DisplayManagement.Handlers;
9+
using OrchardCore.Microsoft.Authentication.Configuration;
10+
using OrchardCore.Microsoft.Authentication.Deployment;
11+
using OrchardCore.Microsoft.Authentication.Drivers;
12+
using OrchardCore.Microsoft.Authentication.Recipes;
13+
using OrchardCore.Microsoft.Authentication.Services;
14+
using OrchardCore.Microsoft.Authentication.Settings;
15+
using OrchardCore.Modules;
16+
using OrchardCore.Navigation;
17+
using OrchardCore.Recipes;
18+
using OrchardCore.Security.Permissions;
19+
20+
namespace OrchardCore.Microsoft.Authentication;
21+
22+
[Feature(MicrosoftAuthenticationConstants.Features.AAD)]
23+
public sealed class AzureADStartup : StartupBase
24+
{
25+
public override void ConfigureServices(IServiceCollection services)
26+
{
27+
services.AddPermissionProvider<Permissions>();
28+
29+
services.AddSingleton<IAzureADService, AzureADService>();
30+
services.AddRecipeExecutionStep<AzureADSettingsStep>();
31+
32+
services.AddSiteDisplayDriver<AzureADSettingsDisplayDriver>();
33+
services.AddNavigationProvider<AdminMenuAAD>();
34+
35+
services.AddTransient<IConfigureOptions<AzureADSettings>, AzureADSettingsConfiguration>();
36+
37+
services.AddTransient<IConfigureOptions<AuthenticationOptions>, AzureADOptionsConfiguration>();
38+
services.AddTransient<IConfigureOptions<MicrosoftIdentityOptions>, AzureADOptionsConfiguration>();
39+
services.AddTransient<IConfigureOptions<PolicySchemeOptions>, AzureADOptionsConfiguration>();
40+
services.AddTransient<IConfigureOptions<OpenIdConnectOptions>, OpenIdConnectOptionsConfiguration>();
41+
42+
services.AddSingleton<IPostConfigureOptions<OpenIdConnectOptions>, OpenIdConnectPostConfigureOptions>();
43+
}
44+
}
45+
46+
[RequireFeatures("OrchardCore.Deployment")]
47+
[Feature(MicrosoftAuthenticationConstants.Features.AAD)]
48+
public sealed class AzureADDeploymentStartup : StartupBase
49+
{
50+
public override void ConfigureServices(IServiceCollection services)
51+
{
52+
services.AddDeployment<AzureADDeploymentSource, AzureADDeploymentStep, AzureADDeploymentStepDriver>();
53+
}
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.Text.Json.Nodes;
2+
using OrchardCore.Deployment;
3+
using OrchardCore.Microsoft.Authentication.Services;
4+
using OrchardCore.Microsoft.Authentication.Settings;
5+
6+
namespace OrchardCore.Microsoft.Authentication.Deployment;
7+
8+
public sealed class MicrosoftAccountDeploymentSource : IDeploymentSource
9+
{
10+
private readonly IMicrosoftAccountService _microsoftAccountService;
11+
12+
public MicrosoftAccountDeploymentSource(IMicrosoftAccountService microsoftAccountService)
13+
{
14+
_microsoftAccountService = microsoftAccountService;
15+
}
16+
17+
public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlanResult result)
18+
{
19+
if (step is not MicrosoftAccountDeploymentStep)
20+
{
21+
return;
22+
}
23+
24+
var microsoftAccountSettings = await _microsoftAccountService.GetSettingsAsync();
25+
26+
result.Steps.Add(new JsonObject
27+
{
28+
["name"] = "Settings",
29+
[nameof(MicrosoftAccountSettings)] = JObject.FromObject(microsoftAccountSettings),
30+
});
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using OrchardCore.Deployment;
2+
3+
namespace OrchardCore.Microsoft.Authentication.Deployment;
4+
5+
public sealed class MicrosoftAccountDeploymentStep : DeploymentStep
6+
{
7+
public MicrosoftAccountDeploymentStep()
8+
{
9+
Name = "MicrosoftAccount";
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using OrchardCore.Deployment;
2+
using OrchardCore.DisplayManagement.Handlers;
3+
using OrchardCore.DisplayManagement.Views;
4+
5+
namespace OrchardCore.Microsoft.Authentication.Deployment;
6+
7+
public sealed class MicrosoftAccountDeploymentStepDriver : DisplayDriver<DeploymentStep, MicrosoftAccountDeploymentStep>
8+
{
9+
public override Task<IDisplayResult> DisplayAsync(MicrosoftAccountDeploymentStep step, BuildDisplayContext context)
10+
{
11+
return CombineAsync(
12+
View("MicrosoftAccountDeploymentStep_Summary", step).Location("Summary", "Content"),
13+
View("MicrosoftAccountDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content")
14+
);
15+
}
16+
17+
public override IDisplayResult Edit(MicrosoftAccountDeploymentStep step, BuildEditorContext context)
18+
=> View("MicrosoftAccountDeploymentStep_Edit", step).Location("Content");
19+
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
using Microsoft.AspNetCore.Authentication;
22
using Microsoft.AspNetCore.Authentication.MicrosoftAccount;
3-
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
43
using Microsoft.Extensions.DependencyInjection;
54
using Microsoft.Extensions.DependencyInjection.Extensions;
65
using Microsoft.Extensions.Options;
7-
using Microsoft.Identity.Web;
86
using OrchardCore.Deployment;
97
using OrchardCore.DisplayManagement.Handlers;
108
using OrchardCore.Microsoft.Authentication.Configuration;
@@ -47,42 +45,12 @@ public override void ConfigureServices(IServiceCollection services)
4745
}
4846
}
4947

50-
[Feature(MicrosoftAuthenticationConstants.Features.AAD)]
51-
public sealed class AzureADStartup : StartupBase
52-
{
53-
public override void ConfigureServices(IServiceCollection services)
54-
{
55-
services.TryAddEnumerable(new ServiceDescriptor(typeof(IPermissionProvider), typeof(Permissions), ServiceLifetime.Scoped));
56-
57-
services.AddSingleton<IAzureADService, AzureADService>();
58-
services.AddRecipeExecutionStep<AzureADSettingsStep>();
59-
60-
services.AddSiteDisplayDriver<AzureADSettingsDisplayDriver>();
61-
services.AddNavigationProvider<AdminMenuAAD>();
62-
63-
services.AddTransient<IConfigureOptions<AzureADSettings>, AzureADSettingsConfiguration>();
64-
65-
// Register the options initializers required by the Policy Scheme, Cookie and OpenId Connect Handler.
66-
services.TryAddEnumerable(new[]
67-
{
68-
// Orchard-specific initializers.
69-
ServiceDescriptor.Transient<IConfigureOptions<AuthenticationOptions>, AzureADOptionsConfiguration>(),
70-
ServiceDescriptor.Transient<IConfigureOptions<MicrosoftIdentityOptions>, AzureADOptionsConfiguration>(),
71-
ServiceDescriptor.Transient<IConfigureOptions<PolicySchemeOptions>, AzureADOptionsConfiguration>(),
72-
ServiceDescriptor.Transient<IConfigureOptions<OpenIdConnectOptions>, OpenIdConnectOptionsConfiguration>(),
73-
74-
// Built-in initializers:
75-
ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIdConnectOptions>, OpenIdConnectPostConfigureOptions>(),
76-
});
77-
}
78-
}
79-
8048
[RequireFeatures("OrchardCore.Deployment")]
81-
[Feature(MicrosoftAuthenticationConstants.Features.AAD)]
82-
public sealed class DeploymentStartup : StartupBase
49+
[Feature(MicrosoftAuthenticationConstants.Features.MicrosoftAccount)]
50+
public sealed class MicrosoftAccountDeploymentStartup : StartupBase
8351
{
8452
public override void ConfigureServices(IServiceCollection services)
8553
{
86-
services.AddDeployment<AzureADDeploymentSource, AzureADDeploymentStep, AzureADDeploymentStepDriver>();
54+
services.AddDeployment<MicrosoftAccountDeploymentSource, MicrosoftAccountDeploymentStep, MicrosoftAccountDeploymentStepDriver>();
8755
}
8856
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h5>@T["Microsoft Account Settings"]</h5>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h5>@T["Microsoft Account Settings"]</h5>
2+
3+
<span class="hint">@T["Adds Microsoft Account settings to the plan."]</span>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h4 class="card-title">@T["Microsoft Account Settings"]</h4>
2+
<p>@T["Exports the Microsoft Account settings."]</p>

src/docs/guides/create-blazor-cms/README.md

+45-1
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,50 @@ Run the application. Click on the `Orchard Core` link on the Left Nav will load
730730
# Add multitenancy to the Blazor App
731731
One of the key features of Orchard Core is its multi-tenancy support. In this section, we will add multi-tenancy support to our Blazor application.
732732

733+
!!! note
734+
Orchard Core listens for requests, also on '/' (e.g. when a site needs to be configured). So having our Blazor app listening to '/' as well can pose a problem.
735+
A solution is to replace `@page "/"` with `@page "/home"` in our `home.razor` file (and update our `navmenu.razor`), so Blazor (the app) will listen to `/home` while Orchard Core is not hindered by that.
736+
737+
=== "Home.razor"
738+
739+
```razor
740+
@page "/home"
741+
742+
<PageTitle>Home</PageTitle>
743+
744+
<h1>Hello, Orchard!</h1>
745+
746+
Welcome to your new Blazor CMS app.
747+
```
748+
749+
=== "NavMenu.razor"
750+
751+
```razor
752+
<div class="top-row ps-3 navbar navbar-dark">
753+
<div class="container-fluid">
754+
<a class="navbar-brand" href="">BlazorCMS</a>
755+
</div>
756+
</div>
757+
758+
<input type="checkbox" title="Navigation menu" class="navbar-toggler" />
759+
760+
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
761+
<nav class="flex-column">
762+
<div class="nav-item px-3">
763+
<NavLink class="nav-link" href="home" Match="NavLinkMatch.All">
764+
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
765+
</NavLink>
766+
</div>
767+
<div class="nav-item px-3">
768+
<NavLink class="nav-link" href="content">
769+
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Orchard Core
770+
</NavLink>
771+
</div>
772+
@*More Nav links here *@
773+
</nav>
774+
</div>
775+
```
776+
733777
## Enable the tenant feature.
734778

735779
In orchard core admin, go to `Configuration` -> `Features` and enable the `Tenants` feature.
@@ -985,4 +1029,4 @@ To further verify that there is now an active SignalR connection with the server
9851029

9861030
In this guide, we have seen how to create a Blazor application, in a Razor class library, and serve it from an Orchard Core CMS application. We have seen how to add multi-tenancy support to the Blazor application, and how to make the Blazor application interactive.
9871031

988-
The source code for this guide is available at [github.com/OrchardCMS/OrchardCore.Samples](https://github.com/OrchardCMS/OrchardCore.Samples)
1032+
The source code for this guide is available at [github.com/OrchardCMS/OrchardCore.Samples](https://github.com/OrchardCMS/OrchardCore.Samples)

src/docs/releases/2.1.0.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ The feature formerly known as **Azure Email Provider** has been renamed to **Azu
106106

107107
Additionally, the configuration provider key for the default provider has changed from `OrchardCore_Email_Azure` to `OrchardCore_Email_AzureCommunicationServices`. While the old key (`OrchardCore_Email_Azure`) will continue to bind for backward compatibility, it is scheduled for removal in the next major release. To ensure future compatibility, it is highly recommended to update your configuration to use the new key.
108108

109+
### Autoroute Feature
110+
111+
### Content Item Shape Alternates Based on Alias and Slug
112+
113+
Content item shapes can be overridden by their alias if `AliasPart` is attached or by their slug if `AutoroutePart` is attached. For examples, refer to the [docs](../reference/modules/Templates/README.md).
114+
109115
## Added Features
110116

111117
### Azure Communication Services SMS Feature
@@ -115,7 +121,3 @@ A new feature was added to allow you to send SMS messages using Azure Communicat
115121
### External Authentication Feature
116122

117123
The new **External Authentication** feature contains common functionality used by multiple external (i.e. non-local) authentication providers (like Microsoft or Google login). See [above](#external-authentication-logic-has-been-separated-from-the-users-feature) for details.
118-
119-
### Content Item Shape Alternates Based on Alias and Slug
120-
121-
Content item shapes can be overridden by their alias if `AliasPart` is attached or by their slug if `AutoroutePart` is attached. For examples, refer to the [docs](../reference/modules/Templates/README.md).

0 commit comments

Comments
 (0)