Merge pull request #7315 from umbraco/v8/bug/3935-useractions-xsrf-validation

Adding extra validation for anti forgery tokens
This commit is contained in:
Warren Buckley
2019-12-27 12:18:25 +00:00
committed by GitHub
3 changed files with 5 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ namespace Umbraco.Web.Mvc
var userIdentity = filterContext.HttpContext.User.Identity as ClaimsIdentity;
if (userIdentity != null)
{
//if there is not CookiePath claim, then exist
//if there is not CookiePath claim, then exit
if (userIdentity.HasClaim(x => x.Type == ClaimTypes.CookiePath) == false)
{
base.OnActionExecuting(filterContext);

View File

@@ -41,6 +41,9 @@ namespace Umbraco.Web.Security
: Guid.NewGuid();
backOfficeIdentity.SessionId = session.ToString();
//since it is a cookie-based authentication add that claim
backOfficeIdentity.AddClaim(new Claim(ClaimTypes.CookiePath, "/", ClaimValueTypes.String, UmbracoBackOfficeIdentity.Issuer, UmbracoBackOfficeIdentity.Issuer, backOfficeIdentity));
}
base.ResponseSignIn(context);

View File

@@ -21,7 +21,7 @@ namespace Umbraco.Web.WebApi.Filters
var userIdentity = ((ApiController) actionContext.ControllerContext.Controller).User.Identity as ClaimsIdentity;
if (userIdentity != null)
{
//if there is not CookiePath claim, then exist
//if there is not CookiePath claim, then exit
if (userIdentity.HasClaim(x => x.Type == ClaimTypes.CookiePath) == false)
{
base.OnActionExecuting(actionContext);