Move UmbracoConfig singleton to Current
This commit is contained in:
@@ -211,8 +211,8 @@ namespace Umbraco.Web.Security
|
||||
//This is a custom middleware, we need to return the user's remaining logged in seconds
|
||||
app.Use<GetUserSecondsMiddleWare>(
|
||||
cookieAuthOptions,
|
||||
UmbracoConfig.For.GlobalSettings(),
|
||||
UmbracoConfig.For.UmbracoSettings().Security,
|
||||
Current.Config.Global(),
|
||||
Current.Config.Umbraco().Security,
|
||||
app.CreateLogger<GetUserSecondsMiddleWare>());
|
||||
|
||||
//This is required so that we can read the auth ticket format outside of this pipeline
|
||||
@@ -316,7 +316,7 @@ namespace Umbraco.Web.Security
|
||||
CookiePath = "/",
|
||||
CookieSecure = globalSettings.UseHttps ? CookieSecureOption.Always : CookieSecureOption.SameAsRequest,
|
||||
CookieHttpOnly = true,
|
||||
CookieDomain = UmbracoConfig.For.UmbracoSettings().Security.AuthCookieDomain
|
||||
CookieDomain = Current.Config.Umbraco().Security.AuthCookieDomain
|
||||
}, stage);
|
||||
|
||||
return app;
|
||||
@@ -362,7 +362,7 @@ namespace Umbraco.Web.Security
|
||||
if (runtimeState.Level != RuntimeLevel.Run) return app;
|
||||
|
||||
var authOptions = app.CreateUmbracoCookieAuthOptions(umbracoContextAccessor, globalSettings, runtimeState, securitySettings);
|
||||
app.Use(typeof(PreviewAuthenticationMiddleware), authOptions, UmbracoConfig.For.GlobalSettings());
|
||||
app.Use(typeof(PreviewAuthenticationMiddleware), authOptions, Current.Config.Global());
|
||||
|
||||
// This middleware must execute at least on PostAuthentication, by default it is on Authorize
|
||||
// The middleware needs to execute after the RoleManagerModule executes which is during PostAuthenticate,
|
||||
@@ -391,7 +391,7 @@ namespace Umbraco.Web.Security
|
||||
/// <param name="explicitPaths"></param>
|
||||
/// <returns></returns>
|
||||
public static UmbracoBackOfficeCookieAuthOptions CreateUmbracoCookieAuthOptions(this IAppBuilder app,
|
||||
IUmbracoContextAccessor umbracoContextAccessor,
|
||||
IUmbracoContextAccessor umbracoContextAccessor,
|
||||
IGlobalSettings globalSettings, IRuntimeState runtimeState, ISecuritySection securitySettings, string[] explicitPaths = null)
|
||||
{
|
||||
//this is how aspnet wires up the default AuthenticationTicket protector so we'll use the same code
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace Umbraco.Web.Security
|
||||
public static void UmbracoLogout(this HttpContextBase http)
|
||||
{
|
||||
if (http == null) throw new ArgumentNullException("http");
|
||||
Logout(http, UmbracoConfig.For.UmbracoSettings().Security.AuthCookieName);
|
||||
Logout(http, Current.Config.Umbraco().Security.AuthCookieName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -181,7 +181,7 @@ namespace Umbraco.Web.Security
|
||||
http.Items[Constants.Security.ForceReAuthFlag] = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// returns the number of seconds the user has until their auth session times out
|
||||
/// </summary>
|
||||
@@ -193,7 +193,7 @@ namespace Umbraco.Web.Security
|
||||
var ticket = http.GetUmbracoAuthTicket();
|
||||
return ticket.GetRemainingAuthSeconds();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// returns the number of seconds the user has until their auth session times out
|
||||
/// </summary>
|
||||
@@ -215,7 +215,7 @@ namespace Umbraco.Web.Security
|
||||
public static AuthenticationTicket GetUmbracoAuthTicket(this HttpContextBase http)
|
||||
{
|
||||
if (http == null) throw new ArgumentNullException(nameof(http));
|
||||
return GetAuthTicket(http, UmbracoConfig.For.UmbracoSettings().Security.AuthCookieName);
|
||||
return GetAuthTicket(http, Current.Config.Umbraco().Security.AuthCookieName);
|
||||
}
|
||||
|
||||
internal static AuthenticationTicket GetUmbracoAuthTicket(this HttpContext http)
|
||||
@@ -227,7 +227,7 @@ namespace Umbraco.Web.Security
|
||||
public static AuthenticationTicket GetUmbracoAuthTicket(this IOwinContext ctx)
|
||||
{
|
||||
if (ctx == null) throw new ArgumentNullException(nameof(ctx));
|
||||
return GetAuthTicket(ctx, UmbracoConfig.For.UmbracoSettings().Security.AuthCookieName);
|
||||
return GetAuthTicket(ctx, Current.Config.Umbraco().Security.AuthCookieName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -342,7 +342,7 @@ namespace Umbraco.Web.Security
|
||||
return null;
|
||||
}
|
||||
//get the ticket
|
||||
|
||||
|
||||
return secureDataFormat.Unprotect(formsCookie);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Umbraco.Web.Security
|
||||
private readonly IUserService _userService;
|
||||
private readonly IRuntimeState _runtimeState;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
|
||||
|
||||
public BackOfficeCookieAuthenticationProvider(IUserService userService, IRuntimeState runtimeState, IGlobalSettings globalSettings)
|
||||
{
|
||||
_userService = userService;
|
||||
@@ -67,7 +67,7 @@ namespace Umbraco.Web.Security
|
||||
Expires = DateTime.Now.AddYears(-1),
|
||||
Path = "/"
|
||||
});
|
||||
context.Response.Cookies.Append(UmbracoConfig.For.UmbracoSettings().Security.AuthCookieName, "", new CookieOptions
|
||||
context.Response.Cookies.Append(Current.Config.Umbraco().Security.AuthCookieName, "", new CookieOptions
|
||||
{
|
||||
Expires = DateTime.Now.AddYears(-1),
|
||||
Path = "/"
|
||||
@@ -111,8 +111,8 @@ namespace Umbraco.Web.Security
|
||||
await SessionIdValidator.ValidateSessionAsync(TimeSpan.FromMinutes(1), context, _globalSettings);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Microsoft.AspNet.Identity.Owin;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models.Identity;
|
||||
|
||||
@@ -23,7 +24,7 @@ namespace Umbraco.Web.Security
|
||||
{
|
||||
_defaultUserGroups = defaultUserGroups ?? new[] { "editor" };
|
||||
_autoLinkExternalAccount = autoLinkExternalAccount;
|
||||
_defaultCulture = defaultCulture ?? UmbracoConfig.For.GlobalSettings().DefaultUILanguage;
|
||||
_defaultCulture = defaultCulture ?? Current.Config.Global().DefaultUILanguage;
|
||||
}
|
||||
|
||||
private readonly string[] _defaultUserGroups;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Umbraco.Web.Security.Providers
|
||||
|
||||
public override string ProviderName
|
||||
{
|
||||
get { return UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider; }
|
||||
get { return Current.Config.Umbraco().Providers.DefaultBackOfficeUserProvider; }
|
||||
}
|
||||
|
||||
protected override MembershipUser ConvertToMembershipUser(IUser entity)
|
||||
|
||||
Reference in New Issue
Block a user