Merge branch '7.3.0' into dev-v8
Conflicts: src/Umbraco.Core/Configuration/UmbracoConfig.cs src/Umbraco.Core/CoreBootManager.cs src/Umbraco.Core/Manifest/ManifestBuilder.cs src/Umbraco.Core/Manifest/ManifestParser.cs src/Umbraco.Core/Persistence/Migrations/MigrationResolver.cs src/Umbraco.Core/Persistence/Migrations/MigrationRunner.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionFourNineZero/RemoveUmbracoAppConstraints.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddIndexToCmsMacroPropertyTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddIndexToCmsMacroTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AddPropertyEditorAliasColumn.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterCmsMacroPropertyTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagRelationsTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterTagsTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AlterUserTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/AssignMissingKeysAndIndexes.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/DropControlIdColumn.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/RemoveCmsMacroPropertyTypeTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateRelatedLinksData.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenOneZero/AssignMissingPrimaryForMySqlKeys.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MigrateAndRemoveTemplateMasterColumn.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/RemoveHelpTextColumn.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/UpdateUniqueIdToHaveCorrectIndexType.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddIndexToUmbracoNodeTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddMissingForeignKeyForContentType.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AlterDataTypePreValueTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/RemoveCmsDocumentAliasColumn.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/DeleteAppTables.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/EnsureAppsTreesUpdated.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/MoveMasterContentTypeData.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/NewCmsContentType2ContentTypeTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RemoveMasterContentTypeColumn.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameCmsTabTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/RenameTabIdColumn.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeAllowedContentTypeTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentTypeTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsContentVersionTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSix/UpdateCmsPropertyTypeGroupTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixOneZero/CreateServerRegistryTable.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AddChangeDocumentTypePermission.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AdditionalIndexesAndKeys.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/AssignMissingPrimaryForMySqlKeys2.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/ChangePasswordColumn.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixTwoZero/UpdateToNewMemberPropertyAliases.cs src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSixZeroOne/UpdatePropertyTypesAndGroups.cs src/Umbraco.Core/Persistence/RepositoryFactory.cs src/Umbraco.Core/PropertyEditors/ParameterEditorResolver.cs src/Umbraco.Core/PropertyEditors/PropertyEditorResolver.cs src/Umbraco.Core/Services/MemberService.cs src/Umbraco.Core/Services/ServerRegistrationService.cs src/Umbraco.Core/Sync/ConfigServerRegistrar.cs src/Umbraco.Core/Sync/ServerMessengerResolver.cs src/Umbraco.Core/Sync/ServerRegistrarResolver.cs src/Umbraco.Core/Umbraco.Core.csproj src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs src/Umbraco.Tests/Migrations/FindingMigrationsTest.cs src/Umbraco.Tests/Migrations/Stubs/AlterUserTableMigrationStub.cs src/Umbraco.Tests/Migrations/TargetVersionSixthMigrationsTest.cs src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs src/Umbraco.Tests/Persistence/Repositories/ContentRepositoryTest.cs src/Umbraco.Tests/Persistence/Repositories/MediaRepositoryTest.cs src/Umbraco.Tests/Persistence/Repositories/ServerRegistrationRepositoryTest.cs src/Umbraco.Tests/Plugins/TypeFinderTests.cs src/Umbraco.Tests/Routing/DomainsAndCulturesTests.cs src/Umbraco.Web.UI/Umbraco.Web.UI.csproj src/Umbraco.Web.UI/config/ClientDependency.config src/Umbraco.Web.UI/packages.config src/Umbraco.Web.UI/umbraco/Views/Default.cshtml src/Umbraco.Web/BaseRest/BaseRestHandler.cs src/Umbraco.Web/Cache/DistributedCacheExtensions.cs src/Umbraco.Web/Editors/AuthenticationController.cs src/Umbraco.Web/Editors/BackOfficeController.cs src/Umbraco.Web/Routing/ContentFinderByIdPath.cs src/Umbraco.Web/Routing/ContentFinderByNiceUrlAndTemplate.cs src/Umbraco.Web/Umbraco.Web.csproj src/Umbraco.Web/WebBootManager.cs src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs src/Umbraco.Web/umbraco.presentation/content.cs src/Umbraco.Web/umbraco.presentation/page.cs src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs src/UmbracoExamine/UmbracoMemberIndexer.cs src/umbraco.MacroEngines/app.config src/umbraco.MacroEngines/packages.config src/umbraco.MacroEngines/umbraco.MacroEngines.csproj src/umbraco.editorControls/app.config src/umbraco.editorControls/packages.config src/umbraco.editorControls/umbraco.editorControls.csproj src/umbraco.providers/app.config
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -31,8 +32,7 @@ namespace Umbraco.Web
|
||||
// Request.RawUrl is still there
|
||||
// response.Redirect does?! always remap to /vdir?!
|
||||
|
||||
public class
|
||||
UmbracoModule : IHttpModule
|
||||
public class UmbracoModule : IHttpModule
|
||||
{
|
||||
#region HttpModule event handlers
|
||||
|
||||
@@ -160,43 +160,6 @@ namespace Umbraco.Web
|
||||
RewriteToUmbracoHandler(httpContext, pcr);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Authenticates the request by reading the FormsAuthentication cookie and setting the
|
||||
/// context and thread principle object
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/// <remarks>
|
||||
/// We will set the identity, culture, etc... for any request that is:
|
||||
/// * A back office request
|
||||
/// * An installer request
|
||||
/// * A /base request (since these can be back office web service requests)
|
||||
/// </remarks>
|
||||
static void AuthenticateRequest(object sender, EventArgs e)
|
||||
{
|
||||
var app = (HttpApplication)sender;
|
||||
var http = new HttpContextWrapper(app.Context);
|
||||
|
||||
// do not process if client-side request
|
||||
if (http.Request.Url.IsClientSideRequest())
|
||||
return;
|
||||
|
||||
var req = new HttpRequestWrapper(app.Request);
|
||||
|
||||
if (ShouldAuthenticateRequest(req, UmbracoContext.Current.OriginalRequestUrl))
|
||||
{
|
||||
//TODO: Here we should have an authentication mechanism, this mechanism should be smart in the way that the ASP.Net 5 pipeline works
|
||||
// in which each registered handler will attempt to authenticate and if it fails it will just call Next() so the next handler
|
||||
// executes. If it is successful, it doesn't call next and assigns the current user/principal.
|
||||
// This might actually all be possible with ASP.Net Identity and how it is setup to work already, need to investigate.
|
||||
|
||||
var ticket = http.GetUmbracoAuthTicket();
|
||||
|
||||
http.AuthenticateCurrentRequest(ticket, ShouldIgnoreTicketRenew(UmbracoContext.Current.OriginalRequestUrl, http) == false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
@@ -306,7 +269,7 @@ namespace Umbraco.Web
|
||||
/// <param name="httpContext"></param>
|
||||
/// <param name="uri"></param>
|
||||
/// <returns></returns>
|
||||
static bool EnsureDocumentRequest(HttpContextBase httpContext, Uri uri)
|
||||
bool EnsureDocumentRequest(HttpContextBase httpContext, Uri uri)
|
||||
{
|
||||
var maybeDoc = true;
|
||||
var lpath = uri.AbsolutePath.ToLowerInvariant();
|
||||
@@ -340,7 +303,7 @@ namespace Umbraco.Web
|
||||
// at that point, either we have no extension, or it is .aspx
|
||||
|
||||
// if the path is reserved then it cannot be a document request
|
||||
if (maybeDoc && GlobalSettings.IsReservedPathOrUrl(lpath, httpContext, RouteTable.Routes))
|
||||
if (maybeDoc && GlobalSettings.IsReservedPathOrUrl(lpath, httpContext, _combinedRouteCollection.Value))
|
||||
maybeDoc = false;
|
||||
|
||||
//NOTE: No need to warn, plus if we do we should log the document, as this message doesn't really tell us anything :)
|
||||
@@ -582,8 +545,6 @@ namespace Umbraco.Web
|
||||
BeginRequest(new HttpContextWrapper(httpContext));
|
||||
};
|
||||
|
||||
app.AuthenticateRequest += AuthenticateRequest;
|
||||
|
||||
app.PostResolveRequestCache += (sender, e) =>
|
||||
{
|
||||
var httpContext = ((HttpApplication)sender).Context;
|
||||
@@ -643,5 +604,42 @@ namespace Umbraco.Web
|
||||
EndRequest(this, args);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This is used to be passed into the GlobalSettings.IsReservedPathOrUrl and will include some 'fake' routes
|
||||
/// used to determine if a path is reserved.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is basically used to reserve paths dynamically
|
||||
/// </remarks>
|
||||
private readonly Lazy<RouteCollection> _combinedRouteCollection = new Lazy<RouteCollection>(() =>
|
||||
{
|
||||
var allRoutes = new RouteCollection();
|
||||
foreach (var route in RouteTable.Routes)
|
||||
{
|
||||
allRoutes.Add(route);
|
||||
}
|
||||
foreach (var reservedPath in ReservedPaths)
|
||||
{
|
||||
try
|
||||
{
|
||||
allRoutes.Add("_umbreserved_" + reservedPath.ReplaceNonAlphanumericChars(""),
|
||||
new Route(reservedPath.TrimStart('/'), new StopRoutingHandler()));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<UmbracoModule>("Could not add reserved path route", ex);
|
||||
}
|
||||
}
|
||||
|
||||
return allRoutes;
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// This is used internally to track any registered callback paths for Identity providers. If the request path matches
|
||||
/// any of the registered paths, then the module will let the request keep executing
|
||||
/// </summary>
|
||||
internal static readonly ConcurrentHashSet<string> ReservedPaths = new ConcurrentHashSet<string>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user