V14: Move towards get guid (#15889)

* Implement using keymap for member

* Remove current usages of GetUserById

* User userId resolver to resolve user key

* Refactor user repository to use GUID not int

* Add happy path test

* Remove user in cache when user gets updated

* Use await in async method

* Fix up according to review

* Update IMetricsConsentService.cs to have async method

* Fix according to review

* Fix more according to comments

* Revert "Fix up according to review"

This reverts commit a75acaaa

* Get current backoffice user from method

* Update user repository delete functionality

* Fix up more test

* Try to get user by id if key fails

* Add user key as required claim

* Fix tests

* Don't set claim in BackofficeController

* Create constant for the Sub claim

---------

Co-authored-by: kjac <kja@umbraco.dk>
This commit is contained in:
Nikolaj Geisle
2024-04-11 13:53:34 +02:00
committed by GitHub
parent 0b62df2bb4
commit d5809da665
31 changed files with 244 additions and 169 deletions

View File

@@ -111,6 +111,7 @@ public class UmbracoBackOfficeIdentityTests
claimsIdentity.AddRequiredClaims(
"1234",
Guid.NewGuid(),
"testing",
"hello world",
new[] { 654 },
@@ -120,7 +121,7 @@ public class UmbracoBackOfficeIdentityTests
new[] { "content", "media" },
new[] { "admin" });
Assert.AreEqual(12, claimsIdentity.Claims.Count());
Assert.AreEqual(13, claimsIdentity.Claims.Count());
Assert.IsNull(claimsIdentity.Actor);
}
}

View File

@@ -18,6 +18,7 @@ public class ClaimsPrincipalExtensionsTests
var backOfficeIdentity = new ClaimsIdentity();
backOfficeIdentity.AddRequiredClaims(
Constants.Security.SuperUserIdAsString,
Constants.Security.SuperUserKey,
"test",
"test",
Enumerable.Empty<int>(),
@@ -55,6 +56,7 @@ public class ClaimsPrincipalExtensionsTests
var backOfficeIdentity = new ClaimsIdentity();
backOfficeIdentity.AddRequiredClaims(
Constants.Security.SuperUserIdAsString,
Constants.Security.SuperUserKey,
"test",
"test",
Enumerable.Empty<int>(),