diff --git a/src/Umbraco.Core/Security/IBackOfficeUserPasswordChecker.cs b/src/Umbraco.Core/Security/IBackOfficeUserPasswordChecker.cs
index 45f5ea44e2..fdf1f1fcf2 100644
--- a/src/Umbraco.Core/Security/IBackOfficeUserPasswordChecker.cs
+++ b/src/Umbraco.Core/Security/IBackOfficeUserPasswordChecker.cs
@@ -11,9 +11,6 @@ namespace Umbraco.Core.Security
///
/// Checks a password for a user
///
- ///
- ///
- ///
///
/// This will allow a developer to auto-link a local account which is required if the user queried doesn't exist locally.
/// The user parameter will always contain the username, if the user doesn't exist locally, the other properties will not be filled in.
diff --git a/src/Umbraco.Infrastructure/Install/InstallSteps/NewInstallStep.cs b/src/Umbraco.Infrastructure/Install/InstallSteps/NewInstallStep.cs
index 96e4a9ae34..80570ae5de 100644
--- a/src/Umbraco.Infrastructure/Install/InstallSteps/NewInstallStep.cs
+++ b/src/Umbraco.Infrastructure/Install/InstallSteps/NewInstallStep.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Specialized;
using System.Net.Http;
using System.Text;
@@ -6,10 +6,9 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Migrations.Install;
+using Umbraco.Core.Security;
using Umbraco.Core.Services;
using Umbraco.Extensions;
using Umbraco.Web.Install.Models;
diff --git a/src/Umbraco.Infrastructure/BackOffice/BackOfficeClaimsPrincipalFactory.cs b/src/Umbraco.Infrastructure/Security/BackOfficeClaimsPrincipalFactory.cs
similarity index 99%
rename from src/Umbraco.Infrastructure/BackOffice/BackOfficeClaimsPrincipalFactory.cs
rename to src/Umbraco.Infrastructure/Security/BackOfficeClaimsPrincipalFactory.cs
index 380ed452d0..8a6680d2bf 100644
--- a/src/Umbraco.Infrastructure/BackOffice/BackOfficeClaimsPrincipalFactory.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeClaimsPrincipalFactory.cs
@@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Umbraco.Core.Security;
-namespace Umbraco.Core.BackOffice
+namespace Umbraco.Core.Security
{
///
/// A
diff --git a/src/Umbraco.Infrastructure/BackOffice/BackOfficeIdentityBuilder.cs b/src/Umbraco.Infrastructure/Security/BackOfficeIdentityBuilder.cs
similarity index 69%
rename from src/Umbraco.Infrastructure/BackOffice/BackOfficeIdentityBuilder.cs
rename to src/Umbraco.Infrastructure/Security/BackOfficeIdentityBuilder.cs
index 90c2823122..c9f8d35ada 100644
--- a/src/Umbraco.Infrastructure/BackOffice/BackOfficeIdentityBuilder.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeIdentityBuilder.cs
@@ -1,19 +1,25 @@
-using System;
+using System;
using System.Reflection;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
-using Umbraco.Core.BackOffice;
-using Umbraco.Core.Security;
-namespace Umbraco.Infrastructure.BackOffice
+namespace Umbraco.Core.Security
{
public class BackOfficeIdentityBuilder : IdentityBuilder
{
- public BackOfficeIdentityBuilder(IServiceCollection services) : base(typeof(BackOfficeIdentityUser), services)
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public BackOfficeIdentityBuilder(IServiceCollection services)
+ : base(typeof(BackOfficeIdentityUser), services)
{
}
- public BackOfficeIdentityBuilder(Type role, IServiceCollection services) : base(typeof(BackOfficeIdentityUser), role, services)
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public BackOfficeIdentityBuilder(Type role, IServiceCollection services)
+ : base(typeof(BackOfficeIdentityUser), role, services)
{
}
@@ -29,10 +35,8 @@ namespace Umbraco.Infrastructure.BackOffice
{
throw new InvalidOperationException($"Invalid Type for TokenProvider: {provider.FullName}");
}
- Services.Configure(options =>
- {
- options.Tokens.ProviderMap[providerName] = new TokenProviderDescriptor(provider);
- });
+
+ Services.Configure(options => options.Tokens.ProviderMap[providerName] = new TokenProviderDescriptor(provider));
Services.AddTransient(provider);
return this;
}
diff --git a/src/Umbraco.Infrastructure/BackOffice/BackOfficeIdentityErrorDescriber.cs b/src/Umbraco.Infrastructure/Security/BackOfficeIdentityErrorDescriber.cs
similarity index 55%
rename from src/Umbraco.Infrastructure/BackOffice/BackOfficeIdentityErrorDescriber.cs
rename to src/Umbraco.Infrastructure/Security/BackOfficeIdentityErrorDescriber.cs
index 012ac5650f..6d36e489b8 100644
--- a/src/Umbraco.Infrastructure/BackOffice/BackOfficeIdentityErrorDescriber.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeIdentityErrorDescriber.cs
@@ -1,11 +1,12 @@
-using Microsoft.AspNetCore.Identity;
+using Microsoft.AspNetCore.Identity;
-namespace Umbraco.Core.BackOffice
+namespace Umbraco.Core.Security
{
///
/// Umbraco back office specific
///
public class BackOfficeIdentityErrorDescriber : IdentityErrorDescriber
{
+ // TODO: Override all the methods in order to provide our own translated error messages
}
}
diff --git a/src/Umbraco.Infrastructure/BackOffice/BackOfficeIdentityOptions.cs b/src/Umbraco.Infrastructure/Security/BackOfficeIdentityOptions.cs
similarity index 72%
rename from src/Umbraco.Infrastructure/BackOffice/BackOfficeIdentityOptions.cs
rename to src/Umbraco.Infrastructure/Security/BackOfficeIdentityOptions.cs
index 2f729072a6..77849c4d0c 100644
--- a/src/Umbraco.Infrastructure/BackOffice/BackOfficeIdentityOptions.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeIdentityOptions.cs
@@ -1,6 +1,6 @@
-using Microsoft.AspNetCore.Identity;
+using Microsoft.AspNetCore.Identity;
-namespace Umbraco.Core.BackOffice
+namespace Umbraco.Core.Security
{
///
/// Identity options specifically for the back office identity implementation
diff --git a/src/Umbraco.Infrastructure/BackOffice/BackOfficeLookupNormalizer.cs b/src/Umbraco.Infrastructure/Security/BackOfficeLookupNormalizer.cs
similarity index 75%
rename from src/Umbraco.Infrastructure/BackOffice/BackOfficeLookupNormalizer.cs
rename to src/Umbraco.Infrastructure/Security/BackOfficeLookupNormalizer.cs
index cc9249d462..957e36d1d0 100644
--- a/src/Umbraco.Infrastructure/BackOffice/BackOfficeLookupNormalizer.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeLookupNormalizer.cs
@@ -1,6 +1,6 @@
-using Microsoft.AspNetCore.Identity;
+using Microsoft.AspNetCore.Identity;
-namespace Umbraco.Core.BackOffice
+namespace Umbraco.Core.Security
{
///
@@ -8,6 +8,8 @@ namespace Umbraco.Core.BackOffice
///
public class BackOfficeLookupNormalizer : ILookupNormalizer
{
+ // TODO: Do we need this?
+
public string NormalizeName(string name) => name;
public string NormalizeEmail(string email) => email;
diff --git a/src/Umbraco.Infrastructure/BackOffice/BackOfficeUserStore.cs b/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
similarity index 99%
rename from src/Umbraco.Infrastructure/BackOffice/BackOfficeUserStore.cs
rename to src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
index e74690b76f..4b4383c402 100644
--- a/src/Umbraco.Infrastructure/BackOffice/BackOfficeUserStore.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeUserStore.cs
@@ -15,7 +15,7 @@ using Umbraco.Core.Scoping;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
-namespace Umbraco.Core.BackOffice
+namespace Umbraco.Core.Security
{
// TODO: Make this into a base class that can be re-used
diff --git a/src/Umbraco.Infrastructure/BackOffice/BackOfficeUserValidator.cs b/src/Umbraco.Infrastructure/Security/BackOfficeUserValidator.cs
similarity index 90%
rename from src/Umbraco.Infrastructure/BackOffice/BackOfficeUserValidator.cs
rename to src/Umbraco.Infrastructure/Security/BackOfficeUserValidator.cs
index b7cbb7555d..8b2c8932a7 100644
--- a/src/Umbraco.Infrastructure/BackOffice/BackOfficeUserValidator.cs
+++ b/src/Umbraco.Infrastructure/Security/BackOfficeUserValidator.cs
@@ -1,8 +1,8 @@
-using System.Threading.Tasks;
+using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Umbraco.Core.Security;
-namespace Umbraco.Core.BackOffice
+namespace Umbraco.Core.Security
{
public class BackOfficeUserValidator : UserValidator
where T : BackOfficeIdentityUser
diff --git a/src/Umbraco.Infrastructure/BackOffice/IBackOfficeUserManager.cs b/src/Umbraco.Infrastructure/Security/IBackOfficeUserManager.cs
similarity index 86%
rename from src/Umbraco.Infrastructure/BackOffice/IBackOfficeUserManager.cs
rename to src/Umbraco.Infrastructure/Security/IBackOfficeUserManager.cs
index be4bd194f9..4235195bb1 100644
--- a/src/Umbraco.Infrastructure/BackOffice/IBackOfficeUserManager.cs
+++ b/src/Umbraco.Infrastructure/Security/IBackOfficeUserManager.cs
@@ -1,6 +1,6 @@
using Umbraco.Core.Security;
-namespace Umbraco.Core.BackOffice
+namespace Umbraco.Core.Security
{
///
/// The user manager for the back office
diff --git a/src/Umbraco.Infrastructure/BackOffice/IUmbracoUserManager.cs b/src/Umbraco.Infrastructure/Security/IUmbracoUserManager.cs
similarity index 99%
rename from src/Umbraco.Infrastructure/BackOffice/IUmbracoUserManager.cs
rename to src/Umbraco.Infrastructure/Security/IUmbracoUserManager.cs
index 803f64e0e6..c50b012dae 100644
--- a/src/Umbraco.Infrastructure/BackOffice/IUmbracoUserManager.cs
+++ b/src/Umbraco.Infrastructure/Security/IUmbracoUserManager.cs
@@ -8,7 +8,7 @@ using Umbraco.Core.Models.Membership;
using Umbraco.Core.Security;
using Umbraco.Web.Models.ContentEditing;
-namespace Umbraco.Core.BackOffice
+namespace Umbraco.Core.Security
{
///
diff --git a/src/Umbraco.Infrastructure/BackOffice/IUserSessionStore.cs b/src/Umbraco.Infrastructure/Security/IUserSessionStore.cs
similarity index 92%
rename from src/Umbraco.Infrastructure/BackOffice/IUserSessionStore.cs
rename to src/Umbraco.Infrastructure/Security/IUserSessionStore.cs
index 69d5408cf7..06b7c2f165 100644
--- a/src/Umbraco.Infrastructure/BackOffice/IUserSessionStore.cs
+++ b/src/Umbraco.Infrastructure/Security/IUserSessionStore.cs
@@ -1,7 +1,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
-namespace Umbraco.Core.BackOffice
+namespace Umbraco.Core.Security
{
///
/// An IUserStore interface part to implement if the store supports validating user session Ids
diff --git a/src/Umbraco.Infrastructure/BackOffice/IdentityExtensions.cs b/src/Umbraco.Infrastructure/Security/IdentityExtensions.cs
similarity index 100%
rename from src/Umbraco.Infrastructure/BackOffice/IdentityExtensions.cs
rename to src/Umbraco.Infrastructure/Security/IdentityExtensions.cs
diff --git a/src/Umbraco.Infrastructure/Security/SignOutAuditEventArgs.cs b/src/Umbraco.Infrastructure/Security/SignOutAuditEventArgs.cs
index 34bd9c9a42..2e5997b603 100644
--- a/src/Umbraco.Infrastructure/Security/SignOutAuditEventArgs.cs
+++ b/src/Umbraco.Infrastructure/Security/SignOutAuditEventArgs.cs
@@ -1,6 +1,6 @@
-using Umbraco.Core.Security;
+using Umbraco.Core.Security;
-namespace Umbraco.Core.BackOffice
+namespace Umbraco.Core.Security
{
///
diff --git a/src/Umbraco.Infrastructure/Security/UserInviteEventArgs.cs b/src/Umbraco.Infrastructure/Security/UserInviteEventArgs.cs
index 2aefb47c14..811092a2c9 100644
--- a/src/Umbraco.Infrastructure/Security/UserInviteEventArgs.cs
+++ b/src/Umbraco.Infrastructure/Security/UserInviteEventArgs.cs
@@ -1,8 +1,8 @@
-using Umbraco.Core.Models.Membership;
+using Umbraco.Core.Models.Membership;
using Umbraco.Core.Security;
using Umbraco.Web.Models.ContentEditing;
-namespace Umbraco.Core.BackOffice
+namespace Umbraco.Core.Security
{
public class UserInviteEventArgs : IdentityAuditEventArgs
{
@@ -25,7 +25,7 @@ namespace Umbraco.Core.BackOffice
///
/// The local user that has been created that is pending the invite
- ///
+ ///
public IUser User { get; }
///
diff --git a/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/UmbracoBackOfficeServiceCollectionExtensionsTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/UmbracoBackOfficeServiceCollectionExtensionsTests.cs
index b6a86344a2..bf198d9819 100644
--- a/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/UmbracoBackOfficeServiceCollectionExtensionsTests.cs
+++ b/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/UmbracoBackOfficeServiceCollectionExtensionsTests.cs
@@ -2,10 +2,9 @@ using System;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
-using Umbraco.Extensions;
-using Umbraco.Core.BackOffice;
-using Umbraco.Tests.Integration.Testing;
using Umbraco.Core.Security;
+using Umbraco.Extensions;
+using Umbraco.Tests.Integration.Testing;
namespace Umbraco.Tests.Integration.Umbraco.Web.BackOffice
{
diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/BackOffice/BackOfficeClaimsPrincipalFactoryTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/BackOffice/BackOfficeClaimsPrincipalFactoryTests.cs
index 9d8edbc75e..f85c15b3bf 100644
--- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/BackOffice/BackOfficeClaimsPrincipalFactoryTests.cs
+++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/BackOffice/BackOfficeClaimsPrincipalFactoryTests.cs
@@ -7,7 +7,6 @@ using Microsoft.Extensions.Options;
using Moq;
using NUnit.Framework;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Security;
diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/BackOffice/NopLookupNormalizerTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/BackOffice/NopLookupNormalizerTests.cs
index 1447b7f97e..02ff01ff3b 100644
--- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/BackOffice/NopLookupNormalizerTests.cs
+++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/BackOffice/NopLookupNormalizerTests.cs
@@ -1,6 +1,6 @@
-using System;
+using System;
using NUnit.Framework;
-using Umbraco.Core.BackOffice;
+using Umbraco.Core.Security;
namespace Umbraco.Tests.UnitTests.Umbraco.Core.BackOffice
{
diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/BackOffice/BackOfficeLookupNormalizerTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/BackOffice/BackOfficeLookupNormalizerTests.cs
index 3feb458fe8..8172a712d8 100644
--- a/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/BackOffice/BackOfficeLookupNormalizerTests.cs
+++ b/src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/BackOffice/BackOfficeLookupNormalizerTests.cs
@@ -1,6 +1,6 @@
-using System;
+using System;
using NUnit.Framework;
-using Umbraco.Core.BackOffice;
+using Umbraco.Core.Security;
namespace Umbraco.Tests.UnitTests.Umbraco.Web.Backoffice
{
diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Web.BackOffice/Controllers/UsersControllerUnitTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Web.BackOffice/Controllers/UsersControllerUnitTests.cs
index 6ecda57cc6..4f4db85e5e 100644
--- a/src/Umbraco.Tests.UnitTests/Umbraco.Web.BackOffice/Controllers/UsersControllerUnitTests.cs
+++ b/src/Umbraco.Tests.UnitTests/Umbraco.Web.BackOffice/Controllers/UsersControllerUnitTests.cs
@@ -1,9 +1,6 @@
-using System.Threading;
using AutoFixture.NUnit3;
-using Microsoft.AspNetCore.Identity;
using Moq;
using NUnit.Framework;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Security;
using Umbraco.Tests.UnitTests.AutoFixture;
using Umbraco.Web.BackOffice.Controllers;
diff --git a/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs b/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
index efe28763f1..f7e10d77af 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
@@ -1,10 +1,10 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security.Claims;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Authentication;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
@@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Mapping;
using Umbraco.Core.Models;
@@ -26,6 +25,7 @@ using Umbraco.Web.BackOffice.Filters;
using Umbraco.Web.BackOffice.Security;
using Umbraco.Web.Common.ActionsResults;
using Umbraco.Web.Common.Attributes;
+using Umbraco.Web.Common.Authorization;
using Umbraco.Web.Common.Controllers;
using Umbraco.Web.Common.Exceptions;
using Umbraco.Web.Common.Filters;
@@ -33,8 +33,6 @@ using Umbraco.Web.Common.Security;
using Umbraco.Web.Models;
using Umbraco.Web.Models.ContentEditing;
using Constants = Umbraco.Core.Constants;
-using Microsoft.AspNetCore.Authorization;
-using Umbraco.Web.Common.Authorization;
namespace Umbraco.Web.BackOffice.Controllers
{
diff --git a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs
index 1ce0831502..89b121b575 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs
@@ -1,15 +1,19 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
+using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authentication;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Options;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Grid;
@@ -22,21 +26,16 @@ using Umbraco.Core.WebAssets;
using Umbraco.Extensions;
using Umbraco.Web.BackOffice.ActionResults;
using Umbraco.Web.BackOffice.Filters;
+using Umbraco.Web.BackOffice.Security;
+using Umbraco.Web.Common.ActionsResults;
using Umbraco.Web.Common.Attributes;
+using Umbraco.Web.Common.Authorization;
using Umbraco.Web.Common.Filters;
using Umbraco.Web.Common.Security;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
using Umbraco.Web.WebAssets;
using Constants = Umbraco.Core.Constants;
-using Microsoft.AspNetCore.Identity;
-using System.Security.Claims;
-using Microsoft.AspNetCore.Http;
-using Umbraco.Web.BackOffice.Security;
-using Umbraco.Web.Common.ActionsResults;
-using Microsoft.AspNetCore.Authorization;
-using Umbraco.Web.Common.Authorization;
-using Microsoft.AspNetCore.Authentication;
namespace Umbraco.Web.BackOffice.Controllers
{
diff --git a/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs b/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
index 7c984e901e..d156551c26 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
@@ -1,15 +1,15 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Options;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
@@ -23,12 +23,10 @@ using Umbraco.Extensions;
using Umbraco.Web.BackOffice.Filters;
using Umbraco.Web.BackOffice.Security;
using Umbraco.Web.Common.Attributes;
+using Umbraco.Web.Common.Authorization;
using Umbraco.Web.Common.Exceptions;
-using Umbraco.Web.Common.Filters;
using Umbraco.Web.Models;
using Umbraco.Web.Models.ContentEditing;
-using Microsoft.AspNetCore.Authorization;
-using Umbraco.Web.Common.Authorization;
namespace Umbraco.Web.BackOffice.Controllers
{
diff --git a/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs b/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
index 38bf69721a..5052f5146e 100644
--- a/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
+++ b/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -6,13 +6,13 @@ using System.Net;
using System.Runtime.Serialization;
using System.Security.Cryptography;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
-using Microsoft.Extensions.Options;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
@@ -26,23 +26,21 @@ using Umbraco.Core.Persistence;
using Umbraco.Core.Security;
using Umbraco.Core.Services;
using Umbraco.Core.Strings;
-using Umbraco.Web.Models;
-using Umbraco.Web.Models.ContentEditing;
using Umbraco.Extensions;
+using Umbraco.Web.BackOffice.ActionResults;
using Umbraco.Web.BackOffice.Filters;
using Umbraco.Web.BackOffice.ModelBinders;
using Umbraco.Web.BackOffice.Security;
-using Umbraco.Web.BackOffice.ActionResults;
+using Umbraco.Web.Common.ActionsResults;
using Umbraco.Web.Common.Attributes;
+using Umbraco.Web.Common.Authorization;
using Umbraco.Web.Common.Exceptions;
using Umbraco.Web.Editors;
+using Umbraco.Web.Models;
+using Umbraco.Web.Models.ContentEditing;
using Constants = Umbraco.Core.Constants;
using IUser = Umbraco.Core.Models.Membership.IUser;
using Task = System.Threading.Tasks.Task;
-using Umbraco.Net;
-using Umbraco.Web.Common.ActionsResults;
-using Microsoft.AspNetCore.Authorization;
-using Umbraco.Web.Common.Authorization;
namespace Umbraco.Web.BackOffice.Controllers
{
diff --git a/src/Umbraco.Web.BackOffice/Extensions/BackOfficeApplicationBuilderExtensions.cs b/src/Umbraco.Web.BackOffice/Extensions/BackOfficeApplicationBuilderExtensions.cs
index a097ead4a1..6ff42a5737 100644
--- a/src/Umbraco.Web.BackOffice/Extensions/BackOfficeApplicationBuilderExtensions.cs
+++ b/src/Umbraco.Web.BackOffice/Extensions/BackOfficeApplicationBuilderExtensions.cs
@@ -2,7 +2,6 @@ using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using SixLabors.ImageSharp.Web.DependencyInjection;
-using Umbraco.Core.BackOffice;
using Umbraco.Web.BackOffice.Middleware;
using Umbraco.Web.BackOffice.Routing;
using Umbraco.Web.Common.Security;
diff --git a/src/Umbraco.Web.BackOffice/Extensions/BackOfficeServiceCollectionExtensions.cs b/src/Umbraco.Web.BackOffice/Extensions/BackOfficeServiceCollectionExtensions.cs
index 74953b19be..9ad448a603 100644
--- a/src/Umbraco.Web.BackOffice/Extensions/BackOfficeServiceCollectionExtensions.cs
+++ b/src/Umbraco.Web.BackOffice/Extensions/BackOfficeServiceCollectionExtensions.cs
@@ -1,18 +1,13 @@
-using System;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
-using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Security;
using Umbraco.Core.Serialization;
-using Umbraco.Infrastructure.BackOffice;
using Umbraco.Net;
using Umbraco.Web.Actions;
using Umbraco.Web.BackOffice.Authorization;
-using Umbraco.Web.BackOffice.Filters;
using Umbraco.Web.BackOffice.Security;
using Umbraco.Web.Common.AspNetCore;
using Umbraco.Web.Common.Authorization;
diff --git a/src/Umbraco.Web.BackOffice/Extensions/WebMappingProfiles.cs b/src/Umbraco.Web.BackOffice/Extensions/WebMappingProfiles.cs
index 600ff101fe..6df63a1655 100644
--- a/src/Umbraco.Web.BackOffice/Extensions/WebMappingProfiles.cs
+++ b/src/Umbraco.Web.BackOffice/Extensions/WebMappingProfiles.cs
@@ -1,8 +1,5 @@
-using Microsoft.Extensions.DependencyInjection;
-using Umbraco.Core;
-using Umbraco.Core.BackOffice;
+using Microsoft.Extensions.DependencyInjection;
using Umbraco.Core.Builder;
-using Umbraco.Core.Composing;
using Umbraco.Core.Mapping;
using Umbraco.Web.BackOffice.Mapping;
diff --git a/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs b/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs
index b5974c870a..1ccb94e988 100644
--- a/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs
+++ b/src/Umbraco.Web.BackOffice/Security/BackOfficeSessionIdValidator.cs
@@ -1,4 +1,4 @@
-
+
using System;
using System.Security.Claims;
using System.Threading.Tasks;
@@ -7,9 +7,9 @@ using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Hosting;
+using Umbraco.Core.Security;
using Umbraco.Extensions;
namespace Umbraco.Web.BackOffice.Security
diff --git a/src/Umbraco.Web.BackOffice/Security/BackOfficeUserManagerAuditer.cs b/src/Umbraco.Web.BackOffice/Security/BackOfficeUserManagerAuditer.cs
index 5f0757ea9c..ef6d278554 100644
--- a/src/Umbraco.Web.BackOffice/Security/BackOfficeUserManagerAuditer.cs
+++ b/src/Umbraco.Web.BackOffice/Security/BackOfficeUserManagerAuditer.cs
@@ -1,8 +1,6 @@
-using Microsoft.Extensions.Options;
using System;
-using System.Threading.Tasks;
+using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Compose;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Models.Membership;
diff --git a/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeIdentityOptions.cs b/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeIdentityOptions.cs
index 31b5de2e43..989c852350 100644
--- a/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeIdentityOptions.cs
+++ b/src/Umbraco.Web.BackOffice/Security/ConfigureBackOfficeIdentityOptions.cs
@@ -1,11 +1,11 @@
-using System;
+using System;
using System.Security.Claims;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
+using Umbraco.Core.Security;
namespace Umbraco.Web.BackOffice.Security
{
diff --git a/src/Umbraco.Web.BackOffice/Security/PasswordChanger.cs b/src/Umbraco.Web.BackOffice/Security/PasswordChanger.cs
index 1a4298cd6b..dd92801d59 100644
--- a/src/Umbraco.Web.BackOffice/Security/PasswordChanger.cs
+++ b/src/Umbraco.Web.BackOffice/Security/PasswordChanger.cs
@@ -1,10 +1,10 @@
-using System;
+using System;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Models;
+using Umbraco.Core.Security;
using Umbraco.Extensions;
using Umbraco.Web.Models;
using IUser = Umbraco.Core.Models.Membership.IUser;
diff --git a/src/Umbraco.Web.Common/Security/BackOfficeUserManager.cs b/src/Umbraco.Web.Common/Security/BackOfficeUserManager.cs
index 9f77cdb7d4..230faeff28 100644
--- a/src/Umbraco.Web.Common/Security/BackOfficeUserManager.cs
+++ b/src/Umbraco.Web.Common/Security/BackOfficeUserManager.cs
@@ -1,17 +1,13 @@
using System;
using System.Collections.Generic;
using System.Security.Principal;
-using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Core;
-using Umbraco.Core.BackOffice;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
-using Umbraco.Core.Models.Identity;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Security;
using Umbraco.Extensions;
@@ -21,7 +17,7 @@ using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Common.Security
{
- public class BackOfficeUserManager : UmbracoUserManager, IBackOfficeUserManager
+ public class BackOfficeUserManager : UmbracoUserManager, IBackOfficeUserManager
{
private readonly IHttpContextAccessor _httpContextAccessor;
@@ -43,6 +39,11 @@ namespace Umbraco.Web.Common.Security
_httpContextAccessor = httpContextAccessor;
}
+ ///
+ /// Gets or sets the default back office user password checker
+ ///
+ public IBackOfficeUserPasswordChecker BackOfficeUserPasswordChecker { get; set; } // TODO: This isn't a good way to set this, it needs to be injected
+
///
///
/// By default this uses the standard ASP.Net Identity approach which is:
diff --git a/src/Umbraco.Web.Common/Security/UmbracoUserManager.cs b/src/Umbraco.Web.Common/Security/UmbracoUserManager.cs
index 675262fd7a..a9f7b0ae74 100644
--- a/src/Umbraco.Web.Common/Security/UmbracoUserManager.cs
+++ b/src/Umbraco.Web.Common/Security/UmbracoUserManager.cs
@@ -5,7 +5,6 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-using Umbraco.Core.BackOffice;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Models.Identity;
@@ -18,27 +17,29 @@ namespace Umbraco.Web.Common.Security
///
/// Abstract class for Umbraco User Managers for back office users or front-end members
///
- /// The type of user
- public abstract class UmbracoUserManager : UserManager
- where T : UmbracoIdentityUser
+ /// The type of user
+ /// /// The type password config
+ public abstract class UmbracoUserManager : UserManager
+ where TUser : UmbracoIdentityUser
+ where TPasswordConfig: class, IPasswordConfiguration, new()
{
private PasswordGenerator _passwordGenerator;
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
public UmbracoUserManager(
IIpResolver ipResolver,
- IUserStore store,
- IOptions optionsAccessor,
- IPasswordHasher passwordHasher,
- IEnumerable> userValidators,
- IEnumerable> passwordValidators,
- BackOfficeLookupNormalizer keyNormalizer,
- BackOfficeIdentityErrorDescriber errors,
+ IUserStore store,
+ IOptions optionsAccessor,
+ IPasswordHasher passwordHasher,
+ IEnumerable> userValidators,
+ IEnumerable> passwordValidators,
+ ILookupNormalizer keyNormalizer,
+ IdentityErrorDescriber errors,
IServiceProvider services,
- ILogger> logger,
- IOptions passwordConfiguration)
+ ILogger> logger,
+ IOptions passwordConfiguration)
: base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
{
IpResolver = ipResolver ?? throw new ArgumentNullException(nameof(ipResolver));
@@ -67,9 +68,10 @@ namespace Umbraco.Web.Common.Security
/// True if the sesion is valid, else false
public virtual async Task ValidateSessionIdAsync(string userId, string sessionId)
{
- var userSessionStore = Store as IUserSessionStore;
+ var userSessionStore = Store as IUserSessionStore;
// if this is not set, for backwards compat (which would be super rare), we'll just approve it
+ // TODO: This should be removed after members supports this
if (userSessionStore == null)
{
return true;
@@ -83,14 +85,9 @@ namespace Umbraco.Web.Common.Security
///
/// The
/// An
- protected virtual IPasswordHasher GetDefaultPasswordHasher(IPasswordConfiguration passwordConfiguration) => new PasswordHasher();
+ protected virtual IPasswordHasher GetDefaultPasswordHasher(IPasswordConfiguration passwordConfiguration) => new PasswordHasher();
- ///
- /// Gets or sets the default back office user password checker
- ///
- public IBackOfficeUserPasswordChecker BackOfficeUserPasswordChecker { get; set; }
-
- public IPasswordConfiguration PasswordConfiguration { get; protected set; }
+ public IPasswordConfiguration PasswordConfiguration { get; }
public IIpResolver IpResolver { get; }
@@ -110,7 +107,7 @@ namespace Umbraco.Web.Common.Security
}
///
- public override async Task CheckPasswordAsync(T user, string password)
+ public override async Task CheckPasswordAsync(TUser user, string password)
{
// we cannot proceed if the user passed in does not have an identity
if (user.HasIdentity == false)
@@ -135,7 +132,7 @@ namespace Umbraco.Web.Common.Security
///
public virtual async Task ChangePasswordWithResetAsync(int userId, string token, string newPassword)
{
- T user = await FindByIdAsync(userId.ToString());
+ TUser user = await FindByIdAsync(userId.ToString());
if (user == null)
{
throw new InvalidOperationException("Could not find user");
@@ -148,9 +145,9 @@ namespace Umbraco.Web.Common.Security
///
/// This is copied from the underlying .NET base class since they decided to not expose it
///
- private IUserSecurityStampStore GetSecurityStore()
+ private IUserSecurityStampStore GetSecurityStore()
{
- var store = Store as IUserSecurityStampStore;
+ var store = Store as IUserSecurityStampStore;
if (store == null)
{
throw new NotSupportedException("The current user store does not implement " + typeof(IUserSecurityStampStore<>));
@@ -165,7 +162,7 @@ namespace Umbraco.Web.Common.Security
private static string NewSecurityStamp() => Guid.NewGuid().ToString();
///
- public override async Task SetLockoutEndDateAsync(T user, DateTimeOffset? lockoutEnd)
+ public override async Task SetLockoutEndDateAsync(TUser user, DateTimeOffset? lockoutEnd)
{
if (user == null)
{
@@ -185,14 +182,14 @@ namespace Umbraco.Web.Common.Security
}
///
- public override async Task ResetAccessFailedCountAsync(T user)
+ public override async Task ResetAccessFailedCountAsync(TUser user)
{
if (user == null)
{
throw new ArgumentNullException(nameof(user));
}
- var lockoutStore = (IUserLockoutStore)Store;
+ var lockoutStore = (IUserLockoutStore)Store;
var accessFailedCount = await GetAccessFailedCountAsync(user);
if (accessFailedCount == 0)
@@ -209,14 +206,14 @@ namespace Umbraco.Web.Common.Security
/// Overrides the Microsoft ASP.NET user management method
///
///
- public override async Task AccessFailedAsync(T user)
+ public override async Task AccessFailedAsync(TUser user)
{
if (user == null)
{
throw new ArgumentNullException(nameof(user));
}
- var lockoutStore = Store as IUserLockoutStore;
+ var lockoutStore = Store as IUserLockoutStore;
if (lockoutStore == null)
{
throw new NotSupportedException("The current user store does not implement " + typeof(IUserLockoutStore<>));
diff --git a/src/Umbraco.Web/Security/ActiveDirectoryBackOfficeUserPasswordChecker.cs b/src/Umbraco.Web/Security/ActiveDirectoryBackOfficeUserPasswordChecker.cs
index 901e7bf81b..46b6540d73 100644
--- a/src/Umbraco.Web/Security/ActiveDirectoryBackOfficeUserPasswordChecker.cs
+++ b/src/Umbraco.Web/Security/ActiveDirectoryBackOfficeUserPasswordChecker.cs
@@ -2,8 +2,6 @@ using System;
using System.DirectoryServices.AccountManagement;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
-using Umbraco.Core.BackOffice;
-using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.Models;
using Umbraco.Core.Security;
diff --git a/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs b/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs
deleted file mode 100644
index 6ce61c90d6..0000000000
--- a/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Security.Claims;
-using System.Threading.Tasks;
-using Microsoft.Extensions.Options;
-using Microsoft.Owin;
-using Microsoft.Owin.Security.Cookies;
-using Umbraco.Core;
-using Umbraco.Core.BackOffice;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.Models;
-using Umbraco.Core.Services;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.Hosting;
-using Umbraco.Core.Security;
-
-namespace Umbraco.Web.Security
-{
- // TODO: Migrate this logic to cookie events in ConfigureUmbracoBackOfficeCookieOptions
-
- public class BackOfficeCookieAuthenticationProvider : CookieAuthenticationProvider
- {
- private readonly IUserService _userService;
- private readonly IRuntimeState _runtimeState;
- private readonly GlobalSettings _globalSettings;
- private readonly IHostingEnvironment _hostingEnvironment;
- private readonly SecuritySettings _securitySettings;
-
- public BackOfficeCookieAuthenticationProvider(IUserService userService, IRuntimeState runtimeState, GlobalSettings globalSettings, IHostingEnvironment hostingEnvironment, IOptions securitySettings)
- {
- _userService = userService;
- _runtimeState = runtimeState;
- _globalSettings = globalSettings;
- _hostingEnvironment = hostingEnvironment;
- _securitySettings = securitySettings.Value;
- }
-
-
- public override void ResponseSignOut(CookieResponseSignOutContext context)
- {
-
- }
-
-
-
- }
-}
diff --git a/src/Umbraco.Web/Security/BackOfficeSignInManager.cs b/src/Umbraco.Web/Security/BackOfficeSignInManager.cs
deleted file mode 100644
index 010c2d4d33..0000000000
--- a/src/Umbraco.Web/Security/BackOfficeSignInManager.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Security.Claims;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Identity;
-using Microsoft.Extensions.Options;
-using Microsoft.Owin;
-using Microsoft.Owin.Logging;
-using Microsoft.Owin.Security;
-using Umbraco.Core;
-using Umbraco.Core.BackOffice;
-using Umbraco.Core.Configuration.Models;
-using Umbraco.Core.Security;
-
-namespace Umbraco.Web.Security
-{
- // TODO: This has been migrated to netcore
- public class BackOfficeSignInManager : IDisposable
- {
- private readonly IBackOfficeUserManager _userManager;
- private readonly IUserClaimsPrincipalFactory _claimsPrincipalFactory;
- private readonly IAuthenticationManager _authenticationManager;
- private readonly ILogger _logger;
- private readonly GlobalSettings _globalSettings;
- private readonly IOwinRequest _request;
-
- public BackOfficeSignInManager(
- IBackOfficeUserManager userManager,
- IUserClaimsPrincipalFactory claimsPrincipalFactory,
- IAuthenticationManager authenticationManager,
- ILogger logger,
- GlobalSettings globalSettings,
- IOwinRequest request)
- {
- _userManager = userManager ?? throw new ArgumentNullException(nameof(userManager));
- _claimsPrincipalFactory = claimsPrincipalFactory ?? throw new ArgumentNullException(nameof(claimsPrincipalFactory));
- _authenticationManager = authenticationManager ?? throw new ArgumentNullException(nameof(authenticationManager));
- _logger = logger ?? throw new ArgumentNullException(nameof(logger));
- _globalSettings = globalSettings ?? throw new ArgumentNullException(nameof(globalSettings));
- _request = request ?? throw new ArgumentNullException(nameof(request));
- }
-
- public void Dispose()
- {
- }
- }
-}
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index b1ddf26b05..50d379102d 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -159,7 +159,6 @@
-
@@ -181,7 +180,6 @@
-
@@ -306,4 +304,4 @@
-
+
\ No newline at end of file