Move basic auth to website part

This commit is contained in:
Bjarke Berg
2021-08-06 11:37:10 +02:00
parent bbd935a0b8
commit 7859798e8b
6 changed files with 6 additions and 6 deletions

View File

@@ -50,7 +50,6 @@ namespace Umbraco.Extensions
builder.Services.ConfigureOptions<ConfigureBackOfficeCookieOptions>();
builder.Services.AddSingleton<BackOfficeExternalLoginProviderErrorMiddleware>();
builder.Services.AddSingleton<BasicAuthAuthenticationMiddleware>();
builder.Services.AddUnique<IBackOfficeAntiforgery, BackOfficeAntiforgery>();
builder.Services.AddUnique<IPasswordChanger<BackOfficeIdentityUser>, PasswordChanger<BackOfficeIdentityUser>>();

View File

@@ -31,7 +31,6 @@ namespace Umbraco.Extensions
a => a.UseMiddleware<KeepAliveMiddleware>());
builder.AppBuilder.UseMiddleware<BackOfficeExternalLoginProviderErrorMiddleware>();
builder.AppBuilder.UseMiddleware<BasicAuthAuthenticationMiddleware>();
return builder;
}

View File

@@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Infrastructure.DependencyInjection;
using Umbraco.Cms.Web.Common.Middleware;
using Umbraco.Cms.Web.Common.Routing;
using Umbraco.Cms.Web.Website.Collections;
using Umbraco.Cms.Web.Website.Controllers;
@@ -47,6 +48,7 @@ namespace Umbraco.Extensions
builder.Services.AddSingleton<MemberModelBuilderFactory>();
builder.Services.AddSingleton<PublicAccessMiddleware>();
builder.Services.AddSingleton<BasicAuthenticationMiddleware>();
builder
.AddDistributedCache()

View File

@@ -2,6 +2,7 @@ using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Web.Common.ApplicationBuilder;
using Umbraco.Cms.Web.Common.Middleware;
using Umbraco.Cms.Web.Website.Middleware;
using Umbraco.Cms.Web.Website.Routing;
@@ -20,6 +21,7 @@ namespace Umbraco.Extensions
public static IUmbracoMiddlewareBuilder WithWebsite(this IUmbracoMiddlewareBuilder builder)
{
builder.AppBuilder.UseMiddleware<PublicAccessMiddleware>();
builder.AppBuilder.UseMiddleware<BasicAuthenticationMiddleware>();
return builder;
}

View File

@@ -1,5 +1,3 @@
using System;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
@@ -15,12 +13,12 @@ namespace Umbraco.Cms.Web.Common.Middleware
/// <summary>
/// Provides basic authentication via back-office credentials for public website access if configured for use and the client IP is not allow listed.
/// </summary>
public class BasicAuthAuthenticationMiddleware : IMiddleware
public class BasicAuthenticationMiddleware : IMiddleware
{
private readonly IRuntimeState _runtimeState;
private readonly IBasicAuthService _basicAuthService;
public BasicAuthAuthenticationMiddleware(
public BasicAuthenticationMiddleware(
IRuntimeState runtimeState,
IBasicAuthService basicAuthService)
{