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

feat: Authentication implementation #316

Merged
merged 10 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.9.28">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.10.48">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -7,7 +7,7 @@

<ItemGroup>
<PackageReference Include="Umbraco.Cms" Version="13.3.0" />
<PackageReference Include="usync" Version="13.2.0" />
<PackageReference Include="usync" Version="13.2.2" />
</ItemGroup>

<!-- Force Windows to use ICU. Otherwise Windows 10 2019H1+ will do it, but older Windows 10 and most, if not all, Windows Server editions will run NLS -->
Expand Down
27 changes: 20 additions & 7 deletions src/Nikcio.UHeadless.IntegrationTests.TestProject/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Nikcio.UHeadless;
using Nikcio.UHeadless.Defaults.Authorization;
using Nikcio.UHeadless.Defaults.ContentItems;
using Nikcio.UHeadless.Defaults.MediaItems;
using Nikcio.UHeadless.Defaults.Members;
Expand All @@ -10,14 +11,24 @@

builder.Services.ConfigureOptions<ConfigureExamineIndexes>();

builder.CreateUmbracoBuilder()

IUmbracoBuilder umbracoBuilder = builder.CreateUmbracoBuilder()
.AddBackOffice()
.AddWebsite()
.AddDeliveryApi()
.AddComposers()
.AddUHeadless(options =>
.AddComposers();

if (builder.Environment.IsDevelopment())
{
umbracoBuilder.AddUHeadless(options =>
{
options.DisableAuthorization = true;
options.AddAuth(new()
{
ApiKey = "uheadless123456789123456789123456789",
Secret = "uheadless123456789123456789123456789uheadless123456789123456789123456789uheadless123456789123456789123456789",
});

options.AddQuery<UtilityClaimGroupsQuery>();

options.AddDefaults();

Expand Down Expand Up @@ -50,8 +61,10 @@
{
parserOptions.MaxAllowedFields = 10000;
});
})
.Build();
});
}

umbracoBuilder.Build();

WebApplication app = builder.Build();

Expand All @@ -60,7 +73,7 @@
app.UseAuthentication();
app.UseAuthorization();

app.MapGraphQL();
app.MapUHeadless();

app.UseUmbraco()
.WithMiddleware(u =>
Expand Down
Loading
Loading