Skip to content

Commit 4223cf6

Browse files
Implements preview tokens
1 parent 2d73b6d commit 4223cf6

File tree

19 files changed

+6725
-10761
lines changed

19 files changed

+6725
-10761
lines changed
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<RootNamespace>MusicFestival.Backend</RootNamespace>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="EPiServer.CMS" Version="12.23.0" />
12-
<PackageReference Include="EPiServer.ContentDefinitionsApi" Version="3.9.0" />
13-
<PackageReference Include="EPiServer.ContentDeliveryApi.Cms" Version="3.9.0" />
14-
<PackageReference Include="EPiServer.OpenIDConnect" Version="3.9.0" />
15-
<PackageReference Include="EPiServer.OpenIDConnect.UI" Version="3.9.0" />
11+
<PackageReference Include="EPiServer.CMS" Version="12.32.5" />
12+
<PackageReference Include="EPiServer.ContentDeliveryApi.Cms" Version="3.12.2" />
1613
</ItemGroup>
1714

1815
</Project>

samples/music-festival-vue-decoupled/backend/Startup.cs

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
using EPiServer.Cms.UI.AspNetIdentity;
33
using EPiServer.ContentApi.Cms;
44
using EPiServer.ContentApi.Core.DependencyInjection;
5-
using EPiServer.ContentDefinitionsApi;
65
using EPiServer.Core;
7-
using EPiServer.OpenIDConnect;
6+
using EPiServer.Security;
87
using EPiServer.ServiceLocation;
98
using EPiServer.Web;
109
using EPiServer.Web.Routing;
@@ -41,39 +40,9 @@ public void ConfigureServices(IServiceCollection services)
4140
.Add("narrow", "Narrow", "u-md-size1of3", string.Empty, "epi-icon__layout--one-third");
4241
});
4342

44-
services.AddOpenIDConnect<ApplicationUser>(
45-
useDevelopmentCertificate: true,
46-
signingCertificate: null,
47-
encryptionCertificate: null,
48-
createSchema: true,
49-
options =>
50-
{
51-
options.RequireHttps = !_webHostingEnvironment.IsDevelopment();
52-
53-
options.Applications.Add(new OpenIDConnectApplication
54-
{
55-
ClientId = "frontend",
56-
Scopes = { "openid", "offline_access", "profile", "email", "roles", ContentDeliveryApiOptionsDefaults.Scope },
57-
PostLogoutRedirectUris = { _frontendUri },
58-
RedirectUris =
59-
{
60-
new Uri(_frontendUri, "/login-callback"),
61-
new Uri(_frontendUri, "/login-renewal"),
62-
},
63-
});
64-
65-
options.Applications.Add(new OpenIDConnectApplication
66-
{
67-
ClientId = "cli",
68-
ClientSecret = "cli",
69-
Scopes = { ContentDefinitionsApiOptionsDefaults.Scope },
70-
});
71-
});
72-
73-
services.AddOpenIDConnectUI();
43+
services.Configure<UIOptions>(options => options.UsePreviewTokens = true);
7444

75-
services.AddContentDefinitionsApi(OpenIDConnectOptionsDefaults.AuthenticationScheme);
76-
services.AddContentDeliveryApi(OpenIDConnectOptionsDefaults.AuthenticationScheme);
45+
services.AddContentDeliveryApi(PreviewTokenOptions.SchemeName);
7746
services.ConfigureForContentDeliveryClient();
7847

7948
services.AddHostedService<ProvisionDatabase>();
@@ -90,9 +59,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
9059
app.UseRouting();
9160

9261
app.UseCors(b => b
93-
.WithOrigins(new[] { "http://localhost:8080" })
62+
.WithOrigins(["http://localhost:8080"])
9463
.WithExposedContentDeliveryApiHeaders()
95-
.WithExposedContentDefinitionApiHeaders()
9664
.WithHeaders("Authorization")
9765
.AllowAnyMethod()
9866
.AllowCredentials());

samples/music-festival-vue-decoupled/backend/properties/launchSettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"MusicFestival.Backend": {
44
"commandName": "Project",
5-
"dotnetRunMessages": "true",
5+
"dotnetRunMessages": true,
66
"launchBrowser": true,
77
"applicationUrl": "http://localhost:8081",
88
"launchUrl": "episerver/cms",
@@ -11,4 +11,4 @@
1111
}
1212
}
1313
}
14-
}
14+
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
VUE_APP_CONTENT_DELIVERY_API=http://localhost:8081
2-
VUE_APP_LOGIN_AUTHORITY=http://localhost:8081
3-
VUE_APP_LOGIN_CLIENT_ID=frontend
1+
VUE_APP_CONTENT_DELIVERY_API=http://localhost:8081
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
VUE_APP_CONTENT_DELIVERY_API=http://localhost:8081
2-
VUE_APP_LOGIN_AUTHORITY=http://localhost:8081
3-
VUE_APP_LOGIN_CLIENT_ID=frontend
1+
VUE_APP_CONTENT_DELIVERY_API=http://localhost:8081

samples/music-festival-vue-decoupled/frontend/MusicFestival.Frontend.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.Build.NoTargets/3.0.4">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
66
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
77
<EnableNETAnalyzers>false</EnableNETAnalyzers>

0 commit comments

Comments
 (0)