diff --git a/src/Umbraco.Core/Configuration/UmbracoConfig.cs b/src/Umbraco.Core/Configuration/UmbracoConfig.cs
index c879d81770..1be7b5aadf 100644
--- a/src/Umbraco.Core/Configuration/UmbracoConfig.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoConfig.cs
@@ -102,29 +102,7 @@ namespace Umbraco.Core.Configuration
return _umbracoSettings;
}
- ///
- /// Only for testing
- ///
- ///
- public void SetBaseRestExtensions(IBaseRestSection value)
- {
- _baseRestExtensions = value;
- }
-
- ///
- /// Gets the IBaseRestSection
- ///
- public IBaseRestSection BaseRestExtensions()
- {
- if (_baseRestExtensions == null)
- {
- var ex = new ConfigurationErrorsException("Could not load the " + typeof(IBaseRestSection) + " from config file, ensure the web.config and BaseRestExtensions.config files are formatted correctly");
- LogHelper.Error("Config error", ex);
- throw ex;
- }
-
- return _baseRestExtensions;
- }
+
//TODO: Add other configurations here !
}
diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs
index 48d09e10d5..d79b2d6123 100644
--- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs
+++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs
@@ -23,7 +23,7 @@ namespace Umbraco.Core.Configuration
/// Gets the version comment (like beta or RC).
///
/// The version comment.
- public static string CurrentComment { get { return "RC"; } }
+ public static string CurrentComment { get { return ""; } }
// Get the version of the umbraco.dll by looking at a class in that dll
// Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx
diff --git a/src/Umbraco.Core/CoreBootManager.cs b/src/Umbraco.Core/CoreBootManager.cs
index 4e38a5d088..7520698c89 100644
--- a/src/Umbraco.Core/CoreBootManager.cs
+++ b/src/Umbraco.Core/CoreBootManager.cs
@@ -315,8 +315,8 @@ namespace Umbraco.Core
///
protected virtual void InitializeResolvers()
{
- var manifestParser = new ManifestParser(ProfilingLogger.Logger, new DirectoryInfo(IOHelper.MapPath("~/App_Plugins")));
- var manifestBuilder = new ManifestBuilder(manifestParser);
+ var manifestParser = new ManifestParser(ProfilingLogger.Logger, new DirectoryInfo(IOHelper.MapPath("~/App_Plugins")), _cacheHelper.RuntimeCache);
+ var manifestBuilder = new ManifestBuilder(_cacheHelper.RuntimeCache, manifestParser);
PropertyEditorResolver.Current = new PropertyEditorResolver(
Container, ProfilingLogger.Logger, () => PluginManager.ResolvePropertyEditors(),
diff --git a/src/Umbraco.Core/Manifest/ManifestBuilder.cs b/src/Umbraco.Core/Manifest/ManifestBuilder.cs
index bd2e54b703..189189638b 100644
--- a/src/Umbraco.Core/Manifest/ManifestBuilder.cs
+++ b/src/Umbraco.Core/Manifest/ManifestBuilder.cs
@@ -43,7 +43,7 @@ namespace Umbraco.Core.Manifest
{
if (manifest.GridEditors != null)
{
- editors.AddRange(ManifestParser.GetGridEditors(manifest.GridEditors));
+ editors.AddRange(_parser.GetGridEditors(manifest.GridEditors));
}
}
diff --git a/src/Umbraco.Core/Manifest/ManifestParser.cs b/src/Umbraco.Core/Manifest/ManifestParser.cs
index a85298b23d..c8c421aea8 100644
--- a/src/Umbraco.Core/Manifest/ManifestParser.cs
+++ b/src/Umbraco.Core/Manifest/ManifestParser.cs
@@ -26,12 +26,13 @@ namespace Umbraco.Core.Manifest
private static readonly Regex CommentsSurround = new Regex(@"/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/", RegexOptions.Compiled);
private static readonly Regex CommentsLine = new Regex(@"^\s*//.*?$", RegexOptions.Compiled | RegexOptions.Multiline);
- public ManifestParser(ILogger logger, DirectoryInfo pluginsDir)
+ public ManifestParser(ILogger logger, DirectoryInfo pluginsDir, IRuntimeCacheProvider cache)
{
if (logger == null) throw new ArgumentNullException("logger");
if (pluginsDir == null) throw new ArgumentNullException("pluginsDir");
_pluginsDir = pluginsDir;
_logger = logger;
+ _cache = cache;
}
///
@@ -39,7 +40,7 @@ namespace Umbraco.Core.Manifest
///
///
///
- internal static IEnumerable GetGridEditors(JArray jsonEditors)
+ internal IEnumerable GetGridEditors(JArray jsonEditors)
{
return JsonConvert.DeserializeObject>(
jsonEditors.ToString(),
diff --git a/src/Umbraco.Core/Persistence/Mappers/UserMapper.cs b/src/Umbraco.Core/Persistence/Mappers/UserMapper.cs
index 66e989da46..52459b1191 100644
--- a/src/Umbraco.Core/Persistence/Mappers/UserMapper.cs
+++ b/src/Umbraco.Core/Persistence/Mappers/UserMapper.cs
@@ -13,19 +13,18 @@ namespace Umbraco.Core.Persistence.Mappers
public sealed class ExternalLoginMapper : BaseMapper
{
private static readonly ConcurrentDictionary PropertyInfoCacheInstance = new ConcurrentDictionary();
- public ExternalLoginMapper()
+
+ public ExternalLoginMapper(ISqlSyntaxProvider sqlSyntax)
+ : base(sqlSyntax)
{
- BuildMap();
}
- #region Overrides of BaseMapper
-
internal override ConcurrentDictionary PropertyInfoCache
{
get { return PropertyInfoCacheInstance; }
}
- internal override void BuildMap()
+ protected override void BuildMap()
{
CacheMap(src => src.Id, dto => dto.Id);
CacheMap(src => src.CreateDate, dto => dto.CreateDate);
@@ -33,8 +32,6 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap(src => src.ProviderKey, dto => dto.ProviderKey);
CacheMap(src => src.UserId, dto => dto.UserId);
}
-
- #endregion
}
[MapperFor(typeof(IUser))]
@@ -46,7 +43,8 @@ namespace Umbraco.Core.Persistence.Mappers
#region Overrides of BaseMapper
- public UserMapper(ISqlSyntaxProvider sqlSyntax) : base(sqlSyntax)
+ public UserMapper(ISqlSyntaxProvider sqlSyntax)
+ : base(sqlSyntax)
{
}
diff --git a/src/Umbraco.Core/Persistence/Repositories/ExternalLoginRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ExternalLoginRepository.cs
index 97c6e4fcf5..315f61e2c0 100644
--- a/src/Umbraco.Core/Persistence/Repositories/ExternalLoginRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/ExternalLoginRepository.cs
@@ -7,6 +7,7 @@ using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Models.Identity;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence.Factories;
+using Umbraco.Core.Persistence.Mappers;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Persistence.SqlSyntax;
using Umbraco.Core.Persistence.UnitOfWork;
@@ -15,8 +16,8 @@ namespace Umbraco.Core.Persistence.Repositories
{
internal class ExternalLoginRepository : PetaPocoRepositoryBase, IExternalLoginRepository
{
- public ExternalLoginRepository(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax)
- : base(work, cache, logger, sqlSyntax)
+ public ExternalLoginRepository(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax, IMappingResolver mappingResolver)
+ : base(work, cache, logger, sqlSyntax, mappingResolver)
{
}
diff --git a/src/Umbraco.Core/Persistence/RepositoryFactory.cs b/src/Umbraco.Core/Persistence/RepositoryFactory.cs
index d74c5d1671..1a72afc900 100644
--- a/src/Umbraco.Core/Persistence/RepositoryFactory.cs
+++ b/src/Umbraco.Core/Persistence/RepositoryFactory.cs
@@ -50,7 +50,7 @@ namespace Umbraco.Core.Persistence
{
return new ExternalLoginRepository(uow,
_cacheHelper,
- _logger, _sqlSyntax);
+ _logger, _sqlSyntax, _mappingResolver);
}
public virtual IPublicAccessRepository CreatePublicAccessRepository(IDatabaseUnitOfWork uow)
diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs
index 81a689f03b..6e6d06217c 100644
--- a/src/Umbraco.Core/Services/ContentService.cs
+++ b/src/Umbraco.Core/Services/ContentService.cs
@@ -476,15 +476,13 @@ namespace Umbraco.Core.Services
Mandate.ParameterCondition(pageSize > 0, "pageSize");
using (var repository = RepositoryFactory.CreateContentRepository(UowProvider.GetUnitOfWork()))
{
-
- var query = Query.Builder;
//if the id is System Root, then just get all
if (id != Constants.System.Root)
{
- query.Where(x => x.ParentId == id);
+ repository.Query.Where(x => x.ParentId == id);
}
long total;
- var contents = repository.GetPagedResultsByQuery(query, pageIndex, pageSize, out total, orderBy, orderDirection, filter);
+ var contents = repository.GetPagedResultsByQuery(repository.Query, pageIndex, pageSize, out total, orderBy, orderDirection, filter);
totalChildren = Convert.ToInt32(total);
return contents;
}
@@ -529,15 +527,13 @@ namespace Umbraco.Core.Services
Mandate.ParameterCondition(pageSize > 0, "pageSize");
using (var repository = RepositoryFactory.CreateContentRepository(UowProvider.GetUnitOfWork()))
{
-
- var query = Query.Builder;
//if the id is System Root, then just get all
if (id != Constants.System.Root)
{
- query.Where(x => x.Path.SqlContains(string.Format(",{0},", id), TextColumnType.NVarchar));
+ repository.Query.Where(x => x.Path.SqlContains(string.Format(",{0},", id), TextColumnType.NVarchar));
}
long total;
- var contents = repository.GetPagedResultsByQuery(query, pageIndex, pageSize, out total, orderBy, orderDirection, filter);
+ var contents = repository.GetPagedResultsByQuery(repository.Query, pageIndex, pageSize, out total, orderBy, orderDirection, filter);
totalChildren = Convert.ToInt32(total);
return contents;
}
diff --git a/src/Umbraco.Core/Services/ExternalLoginService.cs b/src/Umbraco.Core/Services/ExternalLoginService.cs
index f33f1c492b..c5692ad149 100644
--- a/src/Umbraco.Core/Services/ExternalLoginService.cs
+++ b/src/Umbraco.Core/Services/ExternalLoginService.cs
@@ -25,7 +25,7 @@ namespace Umbraco.Core.Services
{
using (var repo = RepositoryFactory.CreateExternalLoginRepository(UowProvider.GetUnitOfWork()))
{
- return repo.GetByQuery(new Query().Where(x => x.UserId == userId));
+ return repo.GetByQuery(repo.Query.Where(x => x.UserId == userId));
}
}
@@ -39,7 +39,7 @@ namespace Umbraco.Core.Services
{
using (var repo = RepositoryFactory.CreateExternalLoginRepository(UowProvider.GetUnitOfWork()))
{
- return repo.GetByQuery(new Query()
+ return repo.GetByQuery(repo.Query
.Where(x => x.ProviderKey == login.ProviderKey && x.LoginProvider == login.LoginProvider));
}
}
diff --git a/src/Umbraco.Core/Services/MediaService.cs b/src/Umbraco.Core/Services/MediaService.cs
index d47bb23c43..ea756ffdda 100644
--- a/src/Umbraco.Core/Services/MediaService.cs
+++ b/src/Umbraco.Core/Services/MediaService.cs
@@ -396,15 +396,14 @@ namespace Umbraco.Core.Services
Mandate.ParameterCondition(pageSize > 0, "pageSize");
using (var repository = RepositoryFactory.CreateMediaRepository(UowProvider.GetUnitOfWork()))
{
- var query = Query.Builder;
//if the id is -1, then just get all
if (id != -1)
{
- query.Where(x => x.ParentId == id);
+ repository.Query.Where(x => x.ParentId == id);
}
long total;
- var medias = repository.GetPagedResultsByQuery(query, pageIndex, pageSize, out total, orderBy, orderDirection, filter);
+ var medias = repository.GetPagedResultsByQuery(repository.Query, pageIndex, pageSize, out total, orderBy, orderDirection, filter);
totalChildren = Convert.ToInt32(total);
return medias;
@@ -449,15 +448,13 @@ namespace Umbraco.Core.Services
Mandate.ParameterCondition(pageSize > 0, "pageSize");
using (var repository = RepositoryFactory.CreateMediaRepository(UowProvider.GetUnitOfWork()))
{
-
- var query = Query.Builder;
//if the id is -1, then just get all
if (id != -1)
{
- query.Where(x => x.Path.SqlContains(string.Format(",{0},", id), TextColumnType.NVarchar));
+ repository.Query.Where(x => x.Path.SqlContains(string.Format(",{0},", id), TextColumnType.NVarchar));
}
long total;
- var contents = repository.GetPagedResultsByQuery(query, pageIndex, pageSize, out total, orderBy, orderDirection, filter);
+ var contents = repository.GetPagedResultsByQuery(repository.Query, pageIndex, pageSize, out total, orderBy, orderDirection, filter);
totalChildren = Convert.ToInt32(total);
return contents;
}
diff --git a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs
index 956903d96d..054c6697a8 100644
--- a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs
+++ b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs
@@ -175,10 +175,12 @@ namespace Umbraco.Core.Sync
//
// FIXME not true if we're running on a background thread, assuming we can?
+ var sqlSyntax = _appContext.DatabaseContext.SqlSyntax;
+
var sql = new Sql().Select("*")
- .From()
- .Where(dto => dto.Id > _lastId)
- .OrderBy(dto => dto.Id);
+ .From(sqlSyntax)
+ .Where(sqlSyntax, dto => dto.Id > _lastId)
+ .OrderBy(sqlSyntax, dto => dto.Id);
var dtos = _appContext.DatabaseContext.Database.Fetch(sql);
if (dtos.Count <= 0) return;
diff --git a/src/Umbraco.Core/Sync/ServerMessengerResolver.cs b/src/Umbraco.Core/Sync/ServerMessengerResolver.cs
index 23013575ac..884624856d 100644
--- a/src/Umbraco.Core/Sync/ServerMessengerResolver.cs
+++ b/src/Umbraco.Core/Sync/ServerMessengerResolver.cs
@@ -10,14 +10,15 @@ namespace Umbraco.Core.Sync
///
public sealed class ServerMessengerResolver : ContainerSingleObjectResolver
{
- ///
- /// Initializes a new instance of the class with a messenger.
- ///
- /// An instance of a messenger.
- /// The resolver is created by the CoreBootManager and thus the constructor remains internal.
- /// initialized before being accessed, otherwise an exception will be thrown when reading it.
- public ServerMessengerResolver(IServerMessenger value) : base(value)
- { }
+ internal ServerMessengerResolver(IServiceContainer container, Type implementationType)
+ : base(container, implementationType)
+ {
+ }
+
+ internal ServerMessengerResolver(IServiceContainer container, Expression> implementationType)
+ : base(container, implementationType)
+ {
+ }
///
/// Sets the messenger.
diff --git a/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs b/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs
index 06d3e6b27d..93d7fceed7 100644
--- a/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs
+++ b/src/Umbraco.Tests/Cache/DistributedCache/DistributedCacheTests.cs
@@ -5,6 +5,7 @@ using Moq;
using NUnit.Framework;
using umbraco.interfaces;
using Umbraco.Core;
+using Umbraco.Core.LightInject;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
using Umbraco.Core.Sync;
@@ -20,10 +21,12 @@ namespace Umbraco.Tests.Cache.DistributedCache
[SetUp]
public void Setup()
{
+ var container = new ServiceContainer();
+
ServerRegistrarResolver.Current = new ServerRegistrarResolver(
new TestServerRegistrar());
ServerMessengerResolver.Current = new ServerMessengerResolver(
- new TestServerMessenger());
+ container, factory => new TestServerMessenger());
CacheRefreshersResolver.Current = new CacheRefreshersResolver(
new ActivatorServiceProvider(), Mock.Of(), () => new[] { typeof(TestCacheRefresher) });
Resolution.Freeze();
diff --git a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs
index a513328de2..381408ca6b 100644
--- a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs
+++ b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs
@@ -5,6 +5,7 @@ using Moq;
using NUnit.Framework;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
+using Umbraco.Core.Cache;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Manifest;
@@ -22,7 +23,7 @@ namespace Umbraco.Tests.Manifest
[SetUp]
public void Setup()
{
- _parser = new ManifestParser(Mock.Of(), new DirectoryInfo(IOHelper.MapPath("~/App_Plugins")));
+ _parser = new ManifestParser(Mock.Of(), new DirectoryInfo(IOHelper.MapPath("~/App_Plugins")), new NullCacheProvider());
}
[Test]
@@ -101,7 +102,7 @@ namespace Umbraco.Tests.Manifest
icon: 'helloworld'
}
]");
- var parser = ManifestParser.GetGridEditors(a).ToArray();
+ var parser = _parser.GetGridEditors(a).ToArray();
Assert.AreEqual(3, parser.Count());
@@ -413,11 +414,11 @@ javascript: ['~/test.js', '~/test2.js']}";
}
]}";
- var result = ManifestParser.CreateManifests(package1, package2, package3, package4, package5).ToArray();
-
- var paramEditors = result.SelectMany(x => ManifestParser.GetParameterEditors(x.ParameterEditors)).ToArray();
- var propEditors = result.SelectMany(x => ManifestParser.GetPropertyEditors(x.PropertyEditors)).ToArray();
- var gridEditors = result.SelectMany(x => ManifestParser.GetGridEditors(x.GridEditors)).ToArray();
+ var result = _parser.CreateManifests(package1, package2, package3, package4, package5).ToArray();
+
+ var paramEditors = result.SelectMany(x => _parser.GetParameterEditors(x.ParameterEditors)).ToArray();
+ var propEditors = result.SelectMany(x => _parser.GetPropertyEditors(x.PropertyEditors)).ToArray();
+ var gridEditors = result.SelectMany(x => _parser.GetGridEditors(x.GridEditors)).ToArray();
Assert.AreEqual(2, gridEditors.Count());
Assert.AreEqual(2, paramEditors.Count());
diff --git a/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs b/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs
index 43946db047..408deaa59a 100644
--- a/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs
+++ b/src/Umbraco.Tests/Migrations/Upgrades/BaseUpgradeTest.cs
@@ -81,6 +81,7 @@ namespace Umbraco.Tests.Migrations.Upgrades
new UpdateCmsContentVersionTable(sql, logger),
new UpdateCmsPropertyTypeGroupTable(sql, logger));
+ bool upgraded = migrationRunner.Execute(db, provider, sqlHelper, true);
Assert.That(upgraded, Is.True);
diff --git a/src/Umbraco.Tests/Plugins/TypeFinderTests.cs b/src/Umbraco.Tests/Plugins/TypeFinderTests.cs
index b5b0f12466..c9a7cb8c0c 100644
--- a/src/Umbraco.Tests/Plugins/TypeFinderTests.cs
+++ b/src/Umbraco.Tests/Plugins/TypeFinderTests.cs
@@ -70,8 +70,8 @@ namespace Umbraco.Tests.Plugins
[Test]
public void Find_Classes_Of_Type()
{
- var typesFound = TypeFinder.FindClassesOfType(_assemblies);
- var originalTypesFound = TypeFinderOriginal.FindClassesOfType(_assemblies);
+ var typesFound = TypeFinder.FindClassesOfType(_assemblies);
+ var originalTypesFound = TypeFinderOriginal.FindClassesOfType(_assemblies);
Assert.AreEqual(originalTypesFound.Count(), typesFound.Count());
Assert.AreEqual(8, typesFound.Count());
diff --git a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs
index dc9daef0fd..566a7bd7c0 100644
--- a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs
+++ b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs
@@ -234,7 +234,9 @@ namespace Umbraco.Tests.TestHelpers
PropertyEditorResolver.Current = new PropertyEditorResolver(
Container, Logger,
() => PluginManager.Current.ResolvePropertyEditors(),
- new ManifestBuilder(new ManifestParser(Logger, new DirectoryInfo(IOHelper.MapPath("~/App_Plugins")))));
+ new ManifestBuilder(
+ new NullCacheProvider(),
+ new ManifestParser(Logger, new DirectoryInfo(IOHelper.MapPath("~/App_Plugins")), new NullCacheProvider())));
if (PropertyValueConvertersResolver.HasCurrent == false)
PropertyValueConvertersResolver.Current = new PropertyValueConvertersResolver(new ActivatorServiceProvider(), Logger);
diff --git a/src/Umbraco.Web.UI/App_Start/UmbracoAuthTokenServerExtensions.cs b/src/Umbraco.Web.UI/App_Start/UmbracoAuthTokenServerExtensions.cs
new file mode 100644
index 0000000000..1308472bca
--- /dev/null
+++ b/src/Umbraco.Web.UI/App_Start/UmbracoAuthTokenServerExtensions.cs
@@ -0,0 +1,82 @@
+//using System;
+//using System.Threading.Tasks;
+//using Microsoft.Owin;
+//using Microsoft.Owin.Security.OAuth;
+//using Owin;
+//using Umbraco.Web.Security.Identity;
+
+//namespace Umbraco.Web.UI
+//{
+// ///
+// /// Extension methods to configure Umbraco for issuing and processing tokens for authentication
+// ///
+// public static class UmbracoAuthTokenServerExtensions
+// {
+
+// public static void ConfigureBackOfficeTokenAuth(this IAppBuilder app)
+// {
+// var oAuthServerOptions = new OAuthAuthorizationServerOptions()
+// {
+// //generally you wouldn't allow this unless on SSL!
+//#if DEBUG
+// AllowInsecureHttp = true,
+//#endif
+// TokenEndpointPath = new PathString("/umbraco/oauth/token"),
+// //set as different auth type to not interfere with anyone doing this on the front-end
+// AuthenticationType = Core.Constants.Security.BackOfficeTokenAuthenticationType,
+// AccessTokenExpireTimeSpan = TimeSpan.FromDays(1),
+// Provider = new BackOfficeAuthServerProvider()
+// {
+// OnValidateClientAuthentication = context =>
+// {
+// // Called to validate that the origin of the request is a registered "client_id", and that the correct credentials for that client are
+// // present on the request. If the web application accepts Basic authentication credentials,
+// // context.TryGetBasicCredentials(out clientId, out clientSecret) may be called to acquire those values if present in the request header. If the web
+// // application accepts "client_id" and "client_secret" as form encoded POST parameters,
+// // context.TryGetFormCredentials(out clientId, out clientSecret) may be called to acquire those values if present in the request body.
+// // If context.Validated is not called the request will not proceed further.
+
+// //** Currently we just accept everything globally
+// context.Validated();
+// return Task.FromResult(0);
+
+// // Example for checking registered clients:
+
+// //** Validate that the data is in the request
+// //string clientId;
+// //string clientSecret;
+// //if (context.TryGetFormCredentials(out clientId, out clientSecret) == false)
+// //{
+// // context.SetError("invalid_client", "Form credentials could not be retrieved.");
+// // context.Rejected();
+// // return Task.FromResult(0);
+// //}
+
+// //var userManager = context.OwinContext.GetUserManager();
+
+// //** Check if this client id is allowed/registered
+// // - lookup in custom table
+
+// //** Verify that the client id and client secret match
+// //if (client != null && userManager.PasswordHasher.VerifyHashedPassword(client.ClientSecretHash, clientSecret) == PasswordVerificationResult.Success)
+// //{
+// // // Client has been verified.
+// // context.Validated(clientId);
+// //}
+// //else
+// //{
+// // // Client could not be validated.
+// // context.SetError("invalid_client", "Client credentials are invalid.");
+// // context.Rejected();
+// //}
+// }
+// }
+// };
+
+// // Token Generation
+// app.UseOAuthAuthorizationServer(oAuthServerOptions);
+// app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
+
+// }
+// }
+//}
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/App_Start/UmbracoCustomOwinStartup.cs b/src/Umbraco.Web.UI/App_Start/UmbracoCustomOwinStartup.cs
new file mode 100644
index 0000000000..69d0f92083
--- /dev/null
+++ b/src/Umbraco.Web.UI/App_Start/UmbracoCustomOwinStartup.cs
@@ -0,0 +1,68 @@
+//using Microsoft.Owin;
+//using Microsoft.Owin.Logging;
+//using Owin;
+//using Umbraco.Core;
+//using Umbraco.Core.Logging;
+//using Umbraco.Core.Security;
+//using Umbraco.Web.Security.Identity;
+//using Umbraco.Web.UI;
+
+////To use this startup class, change the appSetting value in the web.config called
+//// "owin:appStartup" to be "CustomUmbracoOwinStartup"
+
+//[assembly: OwinStartup("UmbracoCustomOwinStartup", typeof(UmbracoCustomOwinStartup))]
+
+//namespace Umbraco.Web.UI
+//{
+// ///
+// /// A custom way to configure OWIN for Umbraco
+// ///
+// ///
+// /// The startup type is specified in appSettings under owin:appStartup - change it to "CustomUmbracoStartup" to use this class
+// ///
+// /// This startup class would allow you to customize the Identity IUserStore and/or IUserManager for the Umbraco Backoffice
+// ///
+// public class UmbracoCustomOwinStartup
+// {
+// public void Configuration(IAppBuilder app)
+// {
+// app.SetLoggerFactory(new OwinLoggerFactory());
+
+// //Configure the Identity user manager for use with Umbraco Back office
+// // (EXPERT: an overload accepts a custom BackOfficeUserStore implementation)
+// app.ConfigureUserManagerForUmbracoBackOffice(
+// ApplicationContext.Current,
+// Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider());
+
+// //Ensure owin is configured for Umbraco back office authentication
+// app
+// .UseUmbracoBackOfficeCookieAuthentication()
+// .UseUmbracoBackOfficeExternalCookieAuthentication();
+
+// /*
+// * Configure external logins for the back office:
+// *
+// * Depending on the authentication sources you would like to enable, you will need to install
+// * certain Nuget packages.
+// *
+// * For Google auth: Install-Package UmbracoCms.Identity.Google
+// * For Facebook auth: Install-Package UmbracoCms.Identity.Facebook
+// * For Microsoft auth: Install-Package UmbracoCms.Identity.MicrosoftAccount
+// * For ActiveDirectory auth: Install-Package UmbracoCms.Identity.ActiveDirectory
+// *
+// * There are many more providers such as Twitter, Yahoo, ActiveDirectory, etc... most information can
+// * be found here: http://www.asp.net/web-api/overview/security/external-authentication-services
+// *
+// * For sample code on using external providers with the Umbraco back office, install one of the
+// * packages listed above to review it's code samples
+// *
+// */
+
+// app.ConfigureBackOfficeGoogleAuth(
+// "1072120697051-p41pro11srud3o3n90j7m00geq426jqt.apps.googleusercontent.com",
+// "cs_LJTXh2rtI01C5OIt9WFkt");
+// }
+
+
+// }
+//}
diff --git a/src/Umbraco.Web.UI/App_Start/UmbracoGoogleAuthExtensions.cs b/src/Umbraco.Web.UI/App_Start/UmbracoGoogleAuthExtensions.cs
new file mode 100644
index 0000000000..a4646867d4
--- /dev/null
+++ b/src/Umbraco.Web.UI/App_Start/UmbracoGoogleAuthExtensions.cs
@@ -0,0 +1,62 @@
+//using System;
+//using System.Collections.Generic;
+//using System.Globalization;
+//using System.Linq;
+//using System.Security.Claims;
+//using System.Threading.Tasks;
+//using System.Web;
+//using Microsoft.Owin;
+//using Owin;
+//using Umbraco.Core;
+//using Umbraco.Web.Security.Identity;
+//using Microsoft.Owin.Security.Google;
+
+//namespace Umbraco.Web.UI
+//{
+// public static class UmbracoGoogleAuthExtensions
+// {
+// ///
+// /// Configure google sign-in
+// ///
+// ///
+// ///
+// ///
+// ///
+// ///
+// ///
+// ///
+// ///
+// /// Nuget installation:
+// /// Microsoft.Owin.Security.Google
+// ///
+// /// Google account documentation for ASP.Net Identity can be found:
+// ///
+// /// http://www.asp.net/web-api/overview/security/external-authentication-services#GOOGLE
+// ///
+// /// Google apps can be created here:
+// ///
+// /// https://developers.google.com/accounts/docs/OpenIDConnect#getcredentials
+// ///
+// ///
+// public static void ConfigureBackOfficeGoogleAuth(this IAppBuilder app, string clientId, string clientSecret,
+// string caption = "Google", string style = "btn-google-plus", string icon = "fa-google-plus")
+// {
+// var googleOptions = new GoogleOAuth2AuthenticationOptions
+// {
+// ClientId = clientId,
+// ClientSecret = clientSecret,
+// //In order to allow using different google providers on the front-end vs the back office,
+// // these settings are very important to make them distinguished from one another.
+// SignInAsAuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType,
+// // By default this is '/signin-google', you will need to change that default value in your
+// // Google developer settings for your web-app in the "REDIRECT URIS" setting
+// CallbackPath = new PathString("/umbraco-google-signin")
+// };
+// googleOptions.ForUmbracoBackOffice(style, icon);
+// googleOptions.Caption = caption;
+// app.UseGoogleAuthentication(googleOptions);
+// }
+
+// }
+
+//}
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/App_Start/UmbracoStandardOwinStartup.cs b/src/Umbraco.Web.UI/App_Start/UmbracoStandardOwinStartup.cs
new file mode 100644
index 0000000000..2aca603d73
--- /dev/null
+++ b/src/Umbraco.Web.UI/App_Start/UmbracoStandardOwinStartup.cs
@@ -0,0 +1,34 @@
+//using System.Security.Claims;
+//using Microsoft.AspNet.Identity.Owin;
+//using Microsoft.Owin;
+//using Owin;
+//using Umbraco.Core;
+//using Umbraco.Core.Models.Identity;
+//using Umbraco.Core.Security;
+//using Umbraco.Web.UI;
+
+////To use this startup class, change the appSetting value in the web.config called
+//// "owin:appStartup" to be "UmbracoStandardOwinStartup"
+
+//[assembly: OwinStartup("UmbracoStandardOwinStartup", typeof(UmbracoStandardOwinStartup))]
+
+//namespace Umbraco.Web.UI
+//{
+// ///
+// /// The standard way to configure OWIN for Umbraco
+// ///
+// ///
+// /// The startup type is specified in appSettings under owin:appStartup - change it to "StandardUmbracoStartup" to use this class
+// ///
+// public class UmbracoStandardOwinStartup : UmbracoDefaultOwinStartup
+// {
+// public override void Configuration(IAppBuilder app)
+// {
+// //ensure the default options are configured
+// base.Configuration(app);
+
+// ////configure token auth
+// //app.ConfigureBackOfficeTokenAuth();
+// }
+// }
+//}
diff --git a/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs b/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs
index 38de7ef3cc..94d83cdcab 100644
--- a/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs
+++ b/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs
@@ -16,10 +16,10 @@ namespace Umbraco.Web
///
public class BatchedDatabaseServerMessenger : Core.Sync.BatchedDatabaseServerMessenger
{
- public BatchedDatabaseServerMessenger(ApplicationContext appContext, bool enableDistCalls, DatabaseServerMessengerOptions options)
+ public BatchedDatabaseServerMessenger(UmbracoApplicationBase appBase, ApplicationContext appContext, bool enableDistCalls, DatabaseServerMessengerOptions options)
: base(appContext, enableDistCalls, options)
{
- UmbracoApplicationBase.ApplicationStarted += Application_Started;
+ appBase.ApplicationStarted += Application_Started;
UmbracoModule.EndRequest += UmbracoModule_EndRequest;
UmbracoModule.RouteAttempt += UmbracoModule_RouteAttempt;
}
diff --git a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs
index 2d31078df6..22a4c3ba25 100644
--- a/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs
+++ b/src/Umbraco.Web/Cache/DistributedCacheExtensions.cs
@@ -127,12 +127,6 @@ namespace Umbraco.Web.Cache
#region Data type cache
- if (dataType == null) return;
- dc.RefreshByJson(DistributedCache.DataTypeCacheRefresherGuid, DataTypeCacheRefresher.SerializeToJsonPayload(dataType));
-
- if (dataType == null) return;
- dc.RefreshByJson(DistributedCache.DataTypeCacheRefresherGuid, DataTypeCacheRefresher.SerializeToJsonPayload(dataType));
-
public static void RefreshDataTypeCache(this DistributedCache dc, IDataTypeDefinition dataType)
{
if (dataType == null) return;
diff --git a/src/Umbraco.Web/Cache/PageCacheRefresher.cs b/src/Umbraco.Web/Cache/PageCacheRefresher.cs
index 73f525383e..3922b6dd3c 100644
--- a/src/Umbraco.Web/Cache/PageCacheRefresher.cs
+++ b/src/Umbraco.Web/Cache/PageCacheRefresher.cs
@@ -49,7 +49,7 @@ namespace Umbraco.Web.Cache
///
public override void RefreshAll()
{
- content.Instance.RefreshContentFromDatabaseAsync();
+ content.Instance.RefreshContentFromDatabase();
base.RefreshAll();
}
diff --git a/src/Umbraco.Web/Editors/AuthenticationController.cs b/src/Umbraco.Web/Editors/AuthenticationController.cs
index eca22db394..479a0180bd 100644
--- a/src/Umbraco.Web/Editors/AuthenticationController.cs
+++ b/src/Umbraco.Web/Editors/AuthenticationController.cs
@@ -2,6 +2,7 @@
using System.Linq;
using System.Net;
using System.Net.Http;
+using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web.Http;
diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs
index 017113a876..d70c541cf2 100644
--- a/src/Umbraco.Web/Editors/BackOfficeController.cs
+++ b/src/Umbraco.Web/Editors/BackOfficeController.cs
@@ -114,8 +114,7 @@ namespace Umbraco.Web.Editors
[OutputCache(Order = 1, VaryByParam = "none", Location = OutputCacheLocation.Server, Duration = 5000)]
public JavaScriptResult Application()
{
- var plugins = new DirectoryInfo(Server.MapPath("~/App_Plugins"));
- var parser = new ManifestParser(Logger, plugins, ApplicationContext.ApplicationCache.RuntimeCache);
+ var parser = GetManifestParser();
var initJs = new JsInitialization(parser);
var initCss = new CssInitialization(parser);
@@ -138,8 +137,7 @@ namespace Umbraco.Web.Editors
{
Func getResult = () =>
{
- var plugins = new DirectoryInfo(Server.MapPath("~/App_Plugins"));
- var parser = new ManifestParser(Logger, plugins, ApplicationContext.ApplicationCache.RuntimeCache);
+ var parser = GetManifestParser();
var initJs = new JsInitialization(parser);
var initCss = new CssInitialization(parser);
var jsResult = initJs.GetJavascriptInitializationArray(HttpContext, new JArray());
@@ -165,6 +163,7 @@ namespace Umbraco.Web.Editors
{
Func> getResult = () =>
{
+ var parser = GetManifestParser();
var editors = new List();
var gridConfig = Server.MapPath("~/Config/grid.editors.config.js");
if (System.IO.File.Exists(gridConfig))
@@ -173,7 +172,7 @@ namespace Umbraco.Web.Editors
{
var arr = JArray.Parse(System.IO.File.ReadAllText(gridConfig));
//ensure the contents parse correctly to objects
- var parsed = ManifestParser.GetGridEditors(arr);
+ var parsed = parser.GetGridEditors(arr);
editors.AddRange(parsed);
}
catch (Exception ex)
@@ -181,9 +180,6 @@ namespace Umbraco.Web.Editors
LogHelper.Error("Could not parse the contents of grid.editors.config.js into a JSON array", ex);
}
}
-
- var plugins = new DirectoryInfo(Server.MapPath("~/App_Plugins"));
- var parser = new ManifestParser(plugins, ApplicationContext.ApplicationCache.RuntimeCache);
var builder = new ManifestBuilder(ApplicationContext.ApplicationCache.RuntimeCache, parser);
foreach (var gridEditor in builder.GridEditors)
{
@@ -460,6 +456,13 @@ namespace Umbraco.Web.Editors
return RedirectToLocal(Url.Action("Default", "BackOffice"));
}
+ private ManifestParser GetManifestParser()
+ {
+ var plugins = new DirectoryInfo(Server.MapPath("~/App_Plugins"));
+ var parser = new ManifestParser(Logger, plugins, ApplicationContext.ApplicationCache.RuntimeCache);
+ return parser;
+ }
+
///
/// Used by Default and AuthorizeUpgrade to render as per normal if there's no external login info, otherwise
/// process the external login info.
diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs
index ac24e3099e..8851e6411c 100644
--- a/src/Umbraco.Web/umbraco.presentation/content.cs
+++ b/src/Umbraco.Web/umbraco.presentation/content.cs
@@ -126,13 +126,7 @@ namespace umbraco
#endregion
#region Public Methods
-
- [Obsolete("This is no longer used and will be removed in future versions, if you use this method it will not refresh 'async' it will perform the refresh on the current thread which is how it should be doing it")]
- public virtual void RefreshContentFromDatabaseAsync()
- {
- RefreshContentFromDatabase();
- }
-
+
///
/// Load content from database and replaces active content when done.
///
@@ -292,41 +286,6 @@ namespace umbraco
}
}
- ///
- /// Updates the document cache for multiple documents
- ///
- /// The documents.
- [Obsolete("This is not used and will be removed from the codebase in future versions")]
- public virtual void UpdateDocumentCache(List Documents)
- {
- // We need to lock content cache here, because we cannot allow other threads
- // making changes at the same time, they need to be queued
- int parentid = Documents[0].Id;
-
-
- using (var safeXml = GetSafeXmlWriter())
- {
- foreach (Document d in Documents)
- {
- PublishNodeDo(d, safeXml.Xml, true);
- }
- }
-
- ClearContextCache();
- }
-
- [Obsolete("Method obsolete in version 4.1 and later, please use UpdateDocumentCache", true)]
- public virtual void UpdateDocumentCacheAsync(int documentId)
- {
- UpdateDocumentCache(documentId);
- }
-
- [Obsolete("Method obsolete in version 4.1 and later, please use ClearDocumentCache", true)]
- public virtual void ClearDocumentCacheAsync(int documentId)
- {
- ClearDocumentCache(documentId);
- }
-
public virtual void ClearDocumentCache(int documentId)
{
// Get the document
@@ -376,21 +335,9 @@ namespace umbraco
//SD: changed to fire event BEFORE running the sitemap!! argh.
FireAfterClearDocumentCache(doc, e);
-
-
- }
+
}
- }
-
- ///
- /// Unpublishes the node.
- ///
- /// The document id.
- [Obsolete("Please use: umbraco.content.ClearDocumentCache", true)]
- public virtual void UnPublishNode(int documentId)
- {
- ClearDocumentCache(documentId);
- }
+ }
#endregion
@@ -555,20 +502,14 @@ order by umbracoNode.level, umbracoNode.sortOrder";
foreach (int childId in children)
{
XmlNode childNode = nodeIndex[childId];
-
parentNode.AppendChild(childNode);
-
+
// Recursively build the content tree under the current child
GenerateXmlDocument(hierarchy, nodeIndex, childId, childNode);
}
}
}
- [Obsolete("This method should not be used and does nothing, xml file persistence is done in a queue using a BackgroundTaskRunner")]
- public void PersistXmlToFile()
- {
- }
-
///
/// Adds a task to the xml cache file persister
///
@@ -621,36 +562,6 @@ order by umbracoNode.level, umbracoNode.sortOrder";
get { return UmbracoConfig.For.UmbracoSettings().Content.CloneXmlContent; }
}
- // whether to use the legacy schema
- private static bool UseLegacySchema
- {
- get { return UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema; }
- }
-
- // whether to keep version of everything (incl. medias & members) in cmsPreviewXml
- // for audit purposes - false by default, not in umbracoSettings.config
- // whether to... no idea what that one does
- // it is false by default and not in UmbracoSettings.config anymore - ignoring
- /*
- private static bool GlobalPreviewStorageEnabled
- {
- get { return UmbracoConfig.For.UmbracoSettings().Content.GlobalPreviewStorageEnabled; }
- }
- */
-
- // ensures config is valid
- private void EnsureConfigurationIsValid()
- {
- if (SyncToXmlFile && SyncFromXmlFile)
- throw new Exception("Cannot run with both ContinouslyUpdateXmlDiskCache and XmlContentCheckForDiskChanges being true.");
-
- if (XmlIsImmutable == false)
- //LogHelper.Warn("Running with CloneXmlContent being false is a bad idea.");
- LogHelper.Warn("CloneXmlContent is false - ignored, we always clone.");
-
- // note: if SyncFromXmlFile then we should also disable / warn that local edits are going to cause issues...
- }
-
#endregion
#region Xml
@@ -679,11 +590,7 @@ order by umbracoNode.level, umbracoNode.sortOrder";
}
}
- [Obsolete("Please use: content.Instance.XmlContent")]
- public static XmlDocument xmlContent
- {
- get { return Instance.XmlContent; }
- }
+
// to be used by content.Instance
protected internal virtual XmlDocument XmlContentInternal
@@ -864,22 +771,12 @@ order by umbracoNode.level, umbracoNode.sortOrder";
private static string ChildNodesXPath
{
- get
- {
- return UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema
- ? "./node"
- : "./* [@id]";
- }
+ get { return "./* [@id]"; }
}
private static string DataNodesXPath
{
- get
- {
- return UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema
- ? "./data"
- : "./* [not(@id)]";
- }
+ get { return "./* [not(@id)]"; }
}
#endregion
@@ -982,18 +879,7 @@ order by umbracoNode.level, umbracoNode.sortOrder";
_fileLock = null; // ensure we don't lock again
}
- }
-
- // not used - just try to read the file
- //private bool XmlFileExists
- //{
- // get
- // {
- // // check that the file exists and has content (is not empty)
- // var fileInfo = new FileInfo(_xmlFileName);
- // return fileInfo.Exists && fileInfo.Length > 0;
- // }
- //}
+ }
private DateTime XmlFileLastWriteTime
{
@@ -1182,7 +1068,7 @@ order by umbracoNode.level, umbracoNode.sortOrder";
// if the document is not there already then it's a new document
// we must make sure that its document type exists in the schema
- if (currentNode == null && UseLegacySchema == false)
+ if (currentNode == null)
EnsureSchema(docNode.Name, xml);
// find the parent
diff --git a/src/UmbracoExamine/UmbracoMemberIndexer.cs b/src/UmbracoExamine/UmbracoMemberIndexer.cs
index 30eaa449d4..be347e5843 100644
--- a/src/UmbracoExamine/UmbracoMemberIndexer.cs
+++ b/src/UmbracoExamine/UmbracoMemberIndexer.cs
@@ -130,7 +130,7 @@ namespace UmbracoExamine
memberCount = 0;
foreach (var member in members)
{
- AddNodesToIndex(new[] { serializer.Serialize(_dataTypeService, member) }, type);
+ AddNodesToIndex(new[] { serializer.Serialize(DataTypeService, member) }, type);
memberCount++;
}
pageIndex++;
@@ -147,7 +147,7 @@ namespace UmbracoExamine
memberCount = 0;
foreach (var member in members)
{
- AddNodesToIndex(new[] {serializer.Serialize(_dataTypeService, member)}, type);
+ AddNodesToIndex(new[] { serializer.Serialize(DataTypeService, member) }, type);
memberCount++;
}
pageIndex++;