V11: Merge dev to contrib (#13363)
* Bump version * Add IContextCache to deploy connectors (#13287) * Add IContextCache and implementations * Update connector interfaces to use IContextCache * Minor cleanup * Move DeployContextCache prefix to constant * Move default implementations to obsolete methods * Remove DeployContextCache and DictionaryCache Co-authored-by: Andy Butland <abutland73@gmail.com> * Add IContextCache to deploy connectors (#13287) * Add IContextCache and implementations * Update connector interfaces to use IContextCache * Minor cleanup * Move DeployContextCache prefix to constant * Move default implementations to obsolete methods * Remove DeployContextCache and DictionaryCache Co-authored-by: Andy Butland <abutland73@gmail.com> * Parse lockId as invariant (#13284) Co-authored-by: Zeegaan <nge@umbraco.dk> * Fix Sqlite database locking issue (#13246) * Add locking for creating scope * Lock the repository instead * Add scope in action instead of locking in service * Fix up post-merge Co-authored-by: Zeegaan <nge@umbraco.dk> * Bump version to next minor * Fix for UseExceptionHandler no longer working since v10.3 RC (#13218) * Fix for UseExceptionHandler no longer working since v10.3 RC * Update the management api path to match the new one Co-authored-by: Nikolaj <nikolajlauridsen@protonmail.ch> * New backoffice: Cleanup management API routes (#13296) * Rename ModelsBuilderDashboard folder to ModelsBuilder * Fix modelsbuilder paths and related naming * Rename analytics route to telemetry * Fix controller bases - routes and tags * Fix items route * Fix more controllerbase routes * Fix route * Fix OpenApi file * Merging DictionaryItem and Dictionary * Fix TrackedReferences naming * Update OpenApi file * Rename Analytics* related types to Telemetry* * New Backoffice: Return AnalyticsLevelViewModel from Telemetry/ (#13298) * Return TelemetryLevelViewModel instead of TelemetryLevel * Fix schema * Change telemetry/current to telemetry/level (cherry picked from commit f2b8494c669cbbf04b623753abbf1be211973aa9) * Add contants for tree and recycle-bin subpaths (cherry picked from commit 4449f56bc00832ea6d357a3854b454791c80e0e2) Co-authored-by: Mole <nikolajlauridsen@protonmail.ch> * Updated Smidge, Npoco and MailKit (#13310) * Updated Smidge, Npoco and MailKit * Added missing command (after breaking interface in npoco) * OpenId Connect authentication for new management API (#13318) * First attempt at OpenIddict * Making headway and more TODOs * Redo current policies for multiple schemas + clean up auth controller * Fix bad merge * Clean up some more test code * Fix spacing * Include AddAuthentication() in OpenIddict addition * A little more clean-up * Move application creation to its own implementation + prepare for middleware to handle valid callback URL * Enable refresh token flow * Fix bad merge from v11/dev * Support auth for Swagger and Postman in non-production environments + use default login screen for back-office logins * Add workaround to client side login handling so the OAuth return URL is not corrupted before redirection * Add temporary configuration handling for new backoffice * Restructure the code somewhat, move singular responsibility from management API project * Add recurring task for cleaning up old tokens in the DB * Fix bad merge + make auth controller align with the new management API structure * Explicitly handle the new management API path as a backoffice path (NOTE: this is potentially behaviorally breaking!) * Redo handle the new management API requests as backoffice requests, this time in a non-breaking way * Add/update TODOs * Revert duplication of current auth policies for OpenIddict (as it breaks everything for V11 without the new management APIs) and introduce a dedicated PoC policy setup for OpenIddict. * Fix failing unit tests * Update src/Umbraco.Cms.ManagementApi/Security/BackOfficeApplicationManager.cs Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> * Update src/Umbraco.Cms.ManagementApi/Security/BackOfficeApplicationManager.cs Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> * Update src/Umbraco.Cms.ManagementApi/Security/BackOfficeApplicationManager.cs Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> * Update src/Umbraco.Core/Routing/UmbracoRequestPaths.cs Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> * V11: Using IFileProvider to access assets added from packages (#13141) * Creating a FileProviderFactory for getting the package.manifest and grid.editors.config.js files through a file provider * Collecting the package.manifest-s from different sources * Searching different sources for grid.editors.config.js * Using an IFileProvider to collect all tours * Refactoring IconService.cs * Typo * Optimizations when looping through the file system * Moving WebRootFileProviderFactory to Umbraco.Web.Common proj * Removes double registering * pluginLangFileSources includes the localPluginFileSources * Comments * Remove linq from foreach * Change workflow for grid.editors.config.js so we check first physical file, then RCL, then Embedded * Clean up * Check if config dir exists * Discover nested package.manifest files * Fix IFileInfo.PhysicalPath check * Revert 712810e1fd995720047832ee689f804185ea69d6 as that way files in content root are preferred over those in web root * Adding comments * Refactoring * Remove PhysicalPath check * Fix registration of WebRootFileProviderFactory * Use Swashbuckle instead of NSwag (#13350) * First attempt at OpenIddict * Making headway and more TODOs * Redo current policies for multiple schemas + clean up auth controller * Fix bad merge * Clean up some more test code * Fix spacing * Include AddAuthentication() in OpenIddict addition * A little more clean-up * Move application creation to its own implementation + prepare for middleware to handle valid callback URL * Enable refresh token flow * Fix bad merge from v11/dev * Support auth for Swagger and Postman in non-production environments + use default login screen for back-office logins * Add workaround to client side login handling so the OAuth return URL is not corrupted before redirection * Add temporary configuration handling for new backoffice * Restructure the code somewhat, move singular responsibility from management API project * Add recurring task for cleaning up old tokens in the DB * Fix bad merge + make auth controller align with the new management API structure * Explicitly handle the new management API path as a backoffice path (NOTE: this is potentially behaviorally breaking!) * Redo handle the new management API requests as backoffice requests, this time in a non-breaking way * Add/update TODOs * Replace NSwag with Swashbuckle and clean up unnecessary client secret workaround * Revert duplication of current auth policies for OpenIddict (as it breaks everything for V11 without the new management APIs) and introduce a dedicated PoC policy setup for OpenIddict. * Fix failing unit tests * A little niceness + export new OpenApi.json and fix path in contract unit test * Redo after merge with v11/dev + filter out unwanted mime types * Remove CreatedResult and NotFoundObjectResult where possible * Custom schema IDs - no more "ViewModel" postfix and make generic lists look less clunky too * A little more explanation for generic schema ID generation * Force Swashbuckle to use enum string names * Update OpenApi.json to match new enum string values * Add clarifying comment about weird looking construct * add workflow to schema (#13349) * add workflow to schema * add licenses to CMSDefinition - intentionally only adding to schema, not registered as options Co-authored-by: Nikolaj <nikolajlauridsen@protonmail.ch> Co-authored-by: Ronald Barendse <ronald@barend.se> Co-authored-by: Andy Butland <abutland73@gmail.com> Co-authored-by: Zeegaan <nge@umbraco.dk> Co-authored-by: Justin Neville <67802060+justin-nevitech@users.noreply.github.com> Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Co-authored-by: Bjarke Berg <mail@bergmania.dk> Co-authored-by: Kenn Jacobsen <kja@umbraco.dk> Co-authored-by: Nathan Woulfe <nathan@nathanw.com.au>
This commit is contained in:
@@ -23,7 +23,8 @@ public class TestUmbracoContextFactory
|
||||
GlobalSettings globalSettings = null,
|
||||
IUmbracoContextAccessor umbracoContextAccessor = null,
|
||||
IHttpContextAccessor httpContextAccessor = null,
|
||||
IPublishedUrlProvider publishedUrlProvider = null)
|
||||
IPublishedUrlProvider publishedUrlProvider = null,
|
||||
UmbracoRequestPathsOptions umbracoRequestPathsOptions = null)
|
||||
{
|
||||
if (globalSettings == null)
|
||||
{
|
||||
@@ -45,6 +46,11 @@ public class TestUmbracoContextFactory
|
||||
publishedUrlProvider = Mock.Of<IPublishedUrlProvider>();
|
||||
}
|
||||
|
||||
if (umbracoRequestPathsOptions == null)
|
||||
{
|
||||
umbracoRequestPathsOptions = new UmbracoRequestPathsOptions();
|
||||
}
|
||||
|
||||
var contentCache = new Mock<IPublishedContentCache>();
|
||||
var mediaCache = new Mock<IPublishedMediaCache>();
|
||||
var snapshot = new Mock<IPublishedSnapshot>();
|
||||
@@ -58,7 +64,7 @@ public class TestUmbracoContextFactory
|
||||
var umbracoContextFactory = new UmbracoContextFactory(
|
||||
umbracoContextAccessor,
|
||||
snapshotService.Object,
|
||||
new UmbracoRequestPaths(Options.Create(globalSettings), hostingEnvironment),
|
||||
new UmbracoRequestPaths(Options.Create(globalSettings), hostingEnvironment, Options.Create(umbracoRequestPathsOptions)),
|
||||
hostingEnvironment,
|
||||
new UriUtility(hostingEnvironment),
|
||||
new AspNetCoreCookieManager(httpContextAccessor),
|
||||
|
||||
@@ -307,9 +307,9 @@ public class UdiTests
|
||||
[UdiDefinition("foo", UdiType.GuidUdi)]
|
||||
public class FooConnector : IServiceConnector
|
||||
{
|
||||
public IArtifact GetArtifact(Udi udi) => throw new NotImplementedException();
|
||||
public IArtifact GetArtifact(Udi udi, IContextCache contextCache) => throw new NotImplementedException();
|
||||
|
||||
public IArtifact GetArtifact(object entity) => throw new NotImplementedException();
|
||||
public IArtifact GetArtifact(object entity, IContextCache contextCache) => throw new NotImplementedException();
|
||||
|
||||
public ArtifactDeployState ProcessInit(IArtifact art, IDeployContext context) =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -47,7 +47,8 @@ public class ManifestParserTests
|
||||
new JsonNetSerializer(),
|
||||
Mock.Of<ILocalizedTextService>(),
|
||||
Mock.Of<IShortStringHelper>(),
|
||||
Mock.Of<IDataValueEditorFactory>());
|
||||
Mock.Of<IDataValueEditorFactory>(),
|
||||
Mock.Of<IManifestFileProviderFactory>());
|
||||
}
|
||||
|
||||
private ManifestParser _parser;
|
||||
|
||||
@@ -18,10 +18,12 @@ public class UmbracoRequestPathsTests
|
||||
{
|
||||
_hostEnvironment = Mock.Of<IWebHostEnvironment>();
|
||||
_globalSettings = new GlobalSettings();
|
||||
_umbracoRequestPathsOptions = new UmbracoRequestPathsOptions();
|
||||
}
|
||||
|
||||
private IWebHostEnvironment _hostEnvironment;
|
||||
private GlobalSettings _globalSettings;
|
||||
private UmbracoRequestPathsOptions _umbracoRequestPathsOptions;
|
||||
|
||||
private IHostingEnvironment CreateHostingEnvironment(string virtualPath = "")
|
||||
{
|
||||
@@ -49,7 +51,7 @@ public class UmbracoRequestPathsTests
|
||||
public void Is_Client_Side_Request(string url, bool assert)
|
||||
{
|
||||
var hostingEnvironment = CreateHostingEnvironment();
|
||||
var umbracoRequestPaths = new UmbracoRequestPaths(Options.Create(_globalSettings), hostingEnvironment);
|
||||
var umbracoRequestPaths = new UmbracoRequestPaths(Options.Create(_globalSettings), hostingEnvironment, Options.Create(_umbracoRequestPathsOptions));
|
||||
|
||||
var uri = new Uri("http://test.com" + url);
|
||||
var result = umbracoRequestPaths.IsClientSideRequest(uri.AbsolutePath);
|
||||
@@ -60,7 +62,7 @@ public class UmbracoRequestPathsTests
|
||||
public void Is_Client_Side_Request_InvalidPath_ReturnFalse()
|
||||
{
|
||||
var hostingEnvironment = CreateHostingEnvironment();
|
||||
var umbracoRequestPaths = new UmbracoRequestPaths(Options.Create(_globalSettings), hostingEnvironment);
|
||||
var umbracoRequestPaths = new UmbracoRequestPaths(Options.Create(_globalSettings), hostingEnvironment, Options.Create(_umbracoRequestPathsOptions));
|
||||
|
||||
// This URL is invalid. Default to false when the extension cannot be determined
|
||||
var uri = new Uri("http://test.com/installing-modules+foobar+\"yipee\"");
|
||||
@@ -85,11 +87,13 @@ public class UmbracoRequestPathsTests
|
||||
[TestCase("http://www.domain.com/myvdir/umbraco/api/blah", "myvdir", false)]
|
||||
[TestCase("http://www.domain.com/MyVdir/umbraco/api/blah", "/myvdir", false)]
|
||||
[TestCase("http://www.domain.com/MyVdir/Umbraco/", "myvdir", true)]
|
||||
// NOTE: this test case is false for now - will be true once the IsBackOfficeRequest tweak from the new management API is put into UmbracoRequestPaths
|
||||
[TestCase("http://www.domain.com/umbraco/management/api/v1.0/my/controller/action/", "", false)]
|
||||
public void Is_Back_Office_Request(string input, string virtualPath, bool expected)
|
||||
{
|
||||
var source = new Uri(input);
|
||||
var hostingEnvironment = CreateHostingEnvironment(virtualPath);
|
||||
var umbracoRequestPaths = new UmbracoRequestPaths(Options.Create(_globalSettings), hostingEnvironment);
|
||||
var umbracoRequestPaths = new UmbracoRequestPaths(Options.Create(_globalSettings), hostingEnvironment, Options.Create(_umbracoRequestPathsOptions));
|
||||
Assert.AreEqual(expected, umbracoRequestPaths.IsBackOfficeRequest(source.AbsolutePath));
|
||||
}
|
||||
|
||||
@@ -106,7 +110,21 @@ public class UmbracoRequestPathsTests
|
||||
{
|
||||
var source = new Uri(input);
|
||||
var hostingEnvironment = CreateHostingEnvironment();
|
||||
var umbracoRequestPaths = new UmbracoRequestPaths(Options.Create(_globalSettings), hostingEnvironment);
|
||||
var umbracoRequestPaths = new UmbracoRequestPaths(Options.Create(_globalSettings), hostingEnvironment, Options.Create(_umbracoRequestPathsOptions));
|
||||
Assert.AreEqual(expected, umbracoRequestPaths.IsInstallerRequest(source.AbsolutePath));
|
||||
}
|
||||
|
||||
[TestCase("http://www.domain.com/some/path", false)]
|
||||
[TestCase("http://www.domain.com/umbraco/surface/blah", false)]
|
||||
[TestCase("http://www.domain.com/umbraco/api/blah", false)]
|
||||
[TestCase("http://www.domain.com/umbraco/management/api/v1.0/my/controller/action/", true)]
|
||||
public void Force_Back_Office_Request_With_Request_Paths_Options(string input, bool expected)
|
||||
{
|
||||
var source = new Uri(input);
|
||||
var hostingEnvironment = CreateHostingEnvironment();
|
||||
var umbracoRequestPathsOptions = new UmbracoRequestPathsOptions();
|
||||
umbracoRequestPathsOptions.IsBackOfficeRequest = _ => true;
|
||||
var umbracoRequestPaths = new UmbracoRequestPaths(Options.Create(_globalSettings), hostingEnvironment, Options.Create(umbracoRequestPathsOptions));
|
||||
Assert.AreEqual(expected, umbracoRequestPaths.IsBackOfficeRequest(source.AbsolutePath));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,13 @@ public class BackOfficeCookieManagerTests
|
||||
public void ShouldAuthenticateRequest_When_Not_Configured()
|
||||
{
|
||||
var globalSettings = new GlobalSettings();
|
||||
var umbracoRequestPathsOptions = new UmbracoRequestPathsOptions();
|
||||
|
||||
var runtime = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Install);
|
||||
var mgr = new BackOfficeCookieManager(
|
||||
Mock.Of<IUmbracoContextAccessor>(),
|
||||
runtime,
|
||||
new UmbracoRequestPaths(Options.Create(globalSettings), TestHelper.GetHostingEnvironment()),
|
||||
new UmbracoRequestPaths(Options.Create(globalSettings), TestHelper.GetHostingEnvironment(), Options.Create(umbracoRequestPathsOptions)),
|
||||
Mock.Of<IBasicAuthService>());
|
||||
|
||||
var result = mgr.ShouldAuthenticateRequest("/umbraco");
|
||||
@@ -41,6 +42,7 @@ public class BackOfficeCookieManagerTests
|
||||
public void ShouldAuthenticateRequest_When_Configured()
|
||||
{
|
||||
var globalSettings = new GlobalSettings();
|
||||
var umbracoRequestPathsOptions = new UmbracoRequestPathsOptions();
|
||||
|
||||
var runtime = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Run);
|
||||
var mgr = new BackOfficeCookieManager(
|
||||
@@ -49,7 +51,8 @@ public class BackOfficeCookieManagerTests
|
||||
new UmbracoRequestPaths(
|
||||
Options.Create(globalSettings),
|
||||
Mock.Of<IHostingEnvironment>(x =>
|
||||
x.ApplicationVirtualPath == "/" && x.ToAbsolute(globalSettings.UmbracoPath) == "/umbraco")),
|
||||
x.ApplicationVirtualPath == "/" && x.ToAbsolute(globalSettings.UmbracoPath) == "/umbraco"),
|
||||
Options.Create(umbracoRequestPathsOptions)),
|
||||
Mock.Of<IBasicAuthService>());
|
||||
|
||||
var result = mgr.ShouldAuthenticateRequest("/umbraco");
|
||||
@@ -61,6 +64,7 @@ public class BackOfficeCookieManagerTests
|
||||
public void ShouldAuthenticateRequest_Is_Back_Office()
|
||||
{
|
||||
var globalSettings = new GlobalSettings();
|
||||
var umbracoRequestPathsOptions = new UmbracoRequestPathsOptions();
|
||||
|
||||
var runtime = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Run);
|
||||
|
||||
@@ -73,7 +77,8 @@ public class BackOfficeCookieManagerTests
|
||||
Options.Create(globalSettings),
|
||||
Mock.Of<IHostingEnvironment>(x =>
|
||||
x.ApplicationVirtualPath == "/" && x.ToAbsolute(globalSettings.UmbracoPath) == "/umbraco" &&
|
||||
x.ToAbsolute(Constants.SystemDirectories.Install) == "/install")),
|
||||
x.ToAbsolute(Constants.SystemDirectories.Install) == "/install"),
|
||||
Options.Create(umbracoRequestPathsOptions)),
|
||||
Mock.Of<IBasicAuthService>());
|
||||
|
||||
var result = mgr.ShouldAuthenticateRequest(remainingTimeoutSecondsPath);
|
||||
@@ -87,6 +92,7 @@ public class BackOfficeCookieManagerTests
|
||||
public void ShouldAuthenticateRequest_Not_Back_Office()
|
||||
{
|
||||
var globalSettings = new GlobalSettings();
|
||||
var umbracoRequestPathsOptions = new UmbracoRequestPathsOptions();
|
||||
|
||||
var runtime = Mock.Of<IRuntimeState>(x => x.Level == RuntimeLevel.Run);
|
||||
|
||||
@@ -97,7 +103,8 @@ public class BackOfficeCookieManagerTests
|
||||
Options.Create(globalSettings),
|
||||
Mock.Of<IHostingEnvironment>(x =>
|
||||
x.ApplicationVirtualPath == "/" && x.ToAbsolute(globalSettings.UmbracoPath) == "/umbraco" &&
|
||||
x.ToAbsolute(Constants.SystemDirectories.Install) == "/install")),
|
||||
x.ToAbsolute(Constants.SystemDirectories.Install) == "/install"),
|
||||
Options.Create(umbracoRequestPathsOptions)),
|
||||
Mock.Of<IBasicAuthService>());
|
||||
|
||||
var result = mgr.ShouldAuthenticateRequest("/notbackoffice");
|
||||
|
||||
Reference in New Issue
Block a user