Gut UmbracoBackOfficeIdentity

This commit is contained in:
Mole
2021-02-17 14:17:38 +01:00
parent 33a99df73f
commit b9d61f3ad8
9 changed files with 48 additions and 212 deletions

View File

@@ -1,10 +1,12 @@
using System;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Infrastructure;
using Owin;
using Umbraco.Core.Security;
using Umbraco.Extensions;
namespace Umbraco.Tests.TestHelpers.ControllerTesting
{
@@ -28,8 +30,17 @@ namespace Umbraco.Tests.TestHelpers.ControllerTesting
protected override Task<AuthenticationTicket> AuthenticateCoreAsync()
{
var securityStamp = Guid.NewGuid().ToString();
var identity = new UmbracoBackOfficeIdentity(
Umbraco.Core.Constants.Security.SuperUserIdAsString, "admin", "Admin", new[] { -1 }, new[] { -1 }, "en-US", securityStamp, new[] { "content", "media", "members" }, new[] { "admin" });
var identity = new ClaimsIdentity();
identity.AddRequiredClaims(Core.Constants.Security.SuperUserIdAsString,
"admin",
"Admin",
new[] { -1 },
new[] { -1 },
"en-US",
securityStamp,
new[] { "content", "media", "members" },
new[] { "admin" });
return Task.FromResult(new AuthenticationTicket(
identity,