Skip to content
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

Updated MVP Site to connect using ContextID #487

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,18 @@ If you want more information about the Cloud plugin for the CLI then you access

## Running the MVP Site
To run the MVP site you will need to create a Development instance of your settings.
To this duplicate the `./headapps/MvpSite/Mvp.Project.MvpSite.Rendering/appsettings.json` and name it `appsettings.Development.json`. Then provide the Sitecore instance, and Okta sections, it's completed it look something like:

Duplicate the `./headapps/MvpSite/Mvp.Project.MvpSite.Rendering/appsettings.json` and name it `appsettings.Development.json`.

Populate the Sitecore, and Okta sections. You can find the `EdgeContextId` & `EditingSecret` in the XMC Deploy application, in the Developer Settings section for your environment. The Okta settings are available after completing the Okta Developer sign-up linked above.

When completed it will look something like:

```json
"Sitecore": {
"InstanceUri": "https://xmc-XXX-XXX-XXX.sitecorecloud.io/",
"LayoutServicePath": "/sitecore/api/graph/edge",
"DefaultSiteName": "mvp-site",
"NotFoundPage": "/404",
"ExperienceEdgeToken": "{B2F8A9B9-7203-4DCF-9314-8B28B043347E}"
"EdgeContextId": "XXX",
"EditingSecret": "XXX",
...
},
...
"Okta" : {
Expand Down
24 changes: 1 addition & 23 deletions authoring/platform/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,6 @@
<PackageReference Update="Sitecore.XmCloud.ContentSearch.Linq" Version="$(PlatformVersion)" />
<PackageReference Update="Sitecore.XmCloud.LayoutService" Version="$(PlatformVersion)" />
<PackageReference Update="Sitecore.XmCloud.Assemblies" Version="$(PlatformVersion)" />

<!-- Rendering Host -->
<PackageReference Update="Sitecore.Assemblies.SitecoreHeadlessServicesServer" Version="$(SitecoreAspNetVersion)" />

<PackageReference Update="Sitecore.AspNetCore.SDK.LayoutService.Client" Version="$(AspNetCoreSdkVersion)" />
<PackageReference Update="Sitecore.AspNetCore.SDK.RenderingEngine" Version="$(AspNetCoreSdkVersion)" />
<PackageReference Update="Sitecore.AspNetCore.SDK.ExperienceEditor" Version="$(AspNetCoreSdkVersion)" />

<PackageReference Update="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(DotNetVersion)" />
<PackageReference Update="Microsoft.Extensions.Http" Version="$(DotNetVersion)"/>
<PackageReference Update="System.ServiceModel.Syndication" Version="$(DotNetVersion)" />

<PackageReference Update="BuildWebCompiler" Version="1.12.405" />
<PackageReference Update="GraphQL.Client" Version="4.0.2" />
<PackageReference Update="GraphQL.Client.Serializer.Newtonsoft" Version="4.0.2" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.2" />
<PackageReference Update="Microsoft.AspNetCore.Session" Version="2.2.0" />
<PackageReference Update="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
<PackageReference Update="Okta.AspNetCore" Version="4.5.0" />
<PackageReference Update="Mvp.Selections.Client" Version="4.14.0" />
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageReference Update="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Update="Markdig" Version="0.37.0" />
</ItemGroup>
</Project>
</Project>
10 changes: 1 addition & 9 deletions headapps/MvpSite/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,9 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageFloatingVersionsEnabled>true</CentralPackageFloatingVersionsEnabled>
<PlatformVersion>1.*</PlatformVersion>
<AspNetCoreSdkVersion>0.0.7</AspNetCoreSdkVersion>
<AspNetCoreSdkVersion>0.0.11</AspNetCoreSdkVersion>
</PropertyGroup>

<ItemGroup Label="Platform Package References">
<PackageVersion Include="Sitecore.XmCloud.Kernel" Version="$(PlatformVersion)" />
<PackageVersion Include="Sitecore.XmCloud.ContentSearch" Version="$(PlatformVersion)" />
<PackageVersion Include="Sitecore.XmCloud.ContentSearch.Linq" Version="$(PlatformVersion)" />
<PackageVersion Include="Sitecore.XmCloud.LayoutService" Version="$(PlatformVersion)" />
<PackageVersion Include="Sitecore.XmCloud.Assemblies" Version="$(PlatformVersion)" />
</ItemGroup>

<ItemGroup Label="Rendering Host Package References">
<PackageVersion Include="Sitecore.AspNetCore.SDK.LayoutService.Client" Version="$(AspNetCoreSdkVersion)" />
<PackageVersion Include="Sitecore.AspNetCore.SDK.RenderingEngine" Version="$(AspNetCoreSdkVersion)" />
Expand Down
23 changes: 4 additions & 19 deletions headapps/MvpSite/MvpSite.Rendering/AppSettings/MvpSiteSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,17 @@ public class MvpSiteSettings
{
public static readonly string Key = "Sitecore";

public Uri? InstanceUri { get; set; }

public string LayoutServicePath { get; set; } = "/sitecore/api/layout/render/jss";

public string? DefaultSiteName { get; set; }

public string? NotFoundPage { get; set; }

public string MvpProfilePageItemPath { get; set; } = "/Directory/Profile/*";

public bool EnableExperienceEditor { get; set; }

public string JssEditingSecret { get; set; } = string.Empty;
public bool EnableEditingMode { get; set; }

public string? ExperienceEdgeToken { get; set; }
public string EditingSecret { get; set; } = string.Empty;

public Uri? LayoutServiceUri
{
get
{
if (InstanceUri == null)
{
return null;
}
public string? EdgeContextId { get; set; }

return new Uri(InstanceUri, LayoutServicePath);
}
}
public string? EditingPath { get; set; }
}
6 changes: 3 additions & 3 deletions headapps/MvpSite/MvpSite.Rendering/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void ConfigureServices(IServiceCollection services)

// Register the GraphQL version of the Sitecore Layout Service Client for use against experience edge & local edge endpoint
services.AddSitecoreLayoutService()
.AddGraphQlHandler("default", Configuration.DefaultSiteName!, Configuration.ExperienceEdgeToken!, Configuration.LayoutServiceUri!)
.AddGraphQlWithContextHandler("default", Configuration.EdgeContextId!, siteName: Configuration.DefaultSiteName!)
.AsDefaultHandler();

services.AddFeatureUser(DotNetConfiguration);
Expand All @@ -59,7 +59,7 @@ public void ConfigureServices(IServiceCollection services)
.ForwardHeaders()

// Enable support for the Experience Editor.
.WithExperienceEditor(options => { options.JssEditingSecret = Configuration.JssEditingSecret; });
.WithExperienceEditor(options => { options.JssEditingSecret = Configuration.EditingSecret; });

// Register MVP Functionality specific services
services.AddFeatureSocialServices()
Expand Down Expand Up @@ -104,7 +104,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
// ReSharper restore StringLiteralTypo - Uri segments
// The Experience Editor endpoint should not be enabled in production DMZ.
// See the SDK documentation for details.
if (Configuration.EnableExperienceEditor)
if (Configuration.EnableEditingMode)
{
// Enable the Sitecore Experience Editor POST endpoint.
app.UseSitecoreExperienceEditor();
Expand Down
9 changes: 5 additions & 4 deletions headapps/MvpSite/MvpSite.Rendering/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"Sitecore": {
"InstanceUri": "<<EDGE_DOMAIN>>",
"LayoutServicePath": "/api/graphql/v1",
"EdgeContextId": "",
"EditingSecret": "",
"EnableEditingMode": true,
"EditingPath": "/api/editing/config",
"DefaultSiteName": "mvp-site",
"NotFoundPage": "/404",
"ExperienceEdgeToken": "<<EDGE_TOKEN>>"
"NotFoundPage": "/404"
},
"AllowedHosts": "*",
"https_port": 443,
Expand Down
Loading