Updates the back office external cookie name to be consistently cased with the other back office cookie names

This commit is contained in:
Shannon
2015-03-25 12:21:41 +11:00
parent 4dcc4807ed
commit 86833aa8bf
5 changed files with 9 additions and 8 deletions

View File

@@ -24,6 +24,7 @@
public const string BackOfficeAuthenticationType = "UmbracoBackOffice";
public const string BackOfficeExternalAuthenticationType = "UmbracoExternalCookie";
public const string BackOfficeExternalCookieName = "UMB_EXTLOGIN";
public const string StartContentNodeIdClaimType = "http://umbraco.org/2015/02/identity/claims/backoffice/startcontentnode";
public const string StartMediaNodeIdClaimType = "http://umbraco.org/2015/02/identity/claims/backoffice/startmedianode";

View File

@@ -166,7 +166,7 @@ namespace Umbraco.Core.Security
Path = "/"
};
//remove the external login cookie too
var extLoginCookie = new CookieHeaderValue(Constants.Security.BackOfficeExternalAuthenticationType, "")
var extLoginCookie = new CookieHeaderValue(Constants.Security.BackOfficeExternalCookieName, "")
{
Expires = DateTime.Now.AddYears(-1),
Path = "/"
@@ -185,7 +185,7 @@ namespace Umbraco.Core.Security
if (response == null) throw new ArgumentNullException("response");
//remove the external login cookie
var extLoginCookie = new CookieHeaderValue(Constants.Security.BackOfficeExternalAuthenticationType, "")
var extLoginCookie = new CookieHeaderValue(Constants.Security.BackOfficeExternalCookieName, "")
{
Expires = DateTime.Now.AddYears(-1),
Path = "/"
@@ -352,7 +352,7 @@ namespace Umbraco.Core.Security
{
if (http == null) throw new ArgumentNullException("http");
//clear the preview cookie and external login
var cookies = new[] { cookieName, Constants.Web.PreviewCookieName, Constants.Security.BackOfficeExternalAuthenticationType };
var cookies = new[] { cookieName, Constants.Web.PreviewCookieName, Constants.Security.BackOfficeExternalCookieName };
foreach (var c in cookies)
{
//remove from the request

View File

@@ -479,9 +479,9 @@ namespace Umbraco.Web.Editors
ViewBag.ExternalSignInError = new[] { "The requested provider (" + loginInfo.Login.LoginProvider + ") has not been linked to to an account" };
//Remove the cookie otherwise this message will keep appearing
if (Response.Cookies[Core.Constants.Security.BackOfficeExternalAuthenticationType] != null)
if (Response.Cookies[Core.Constants.Security.BackOfficeExternalCookieName] != null)
{
Response.Cookies[Core.Constants.Security.BackOfficeExternalAuthenticationType].Expires = DateTime.MinValue;
Response.Cookies[Core.Constants.Security.BackOfficeExternalCookieName].Expires = DateTime.MinValue;
}
}

View File

@@ -111,12 +111,12 @@ namespace Umbraco.Web.Security.Identity
{
if (app == null) throw new ArgumentNullException("app");
app.SetDefaultSignInAsAuthenticationType("UmbracoExternalCookie");
app.SetDefaultSignInAsAuthenticationType(Constants.Security.BackOfficeExternalAuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType,
AuthenticationMode = AuthenticationMode.Passive,
CookieName = Constants.Security.BackOfficeExternalAuthenticationType,
CookieName = Constants.Security.BackOfficeExternalCookieName,
ExpireTimeSpan = TimeSpan.FromMinutes(5),
//Custom cookie manager so we can filter requests
CookieManager = new BackOfficeCookieManager(new SingletonUmbracoContextAccessor()),

View File

@@ -99,7 +99,7 @@ namespace Umbraco.Web.Security
// and cookie handling is different with httpcontext vs webapi and owin, normally we'd do:
//_httpContext.GetOwinContext().Authentication.SignOut(Constants.Security.BackOfficeExternalAuthenticationType);
var externalLoginCookie = _httpContext.Request.Cookies.Get(Constants.Security.BackOfficeExternalAuthenticationType);
var externalLoginCookie = _httpContext.Request.Cookies.Get(Constants.Security.BackOfficeExternalCookieName);
if (externalLoginCookie != null)
{
externalLoginCookie.Expires = DateTime.Now.AddYears(-1);