From bda1e81c87a34bc0e6d2ce805f706a726087e957 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sun, 30 Jan 2022 01:30:58 +0100 Subject: feat: WIP: Map github logins When github is used for login, we want to create a mapping to a regular user in our database. This is mainly so that we don't have to change the PK in our database or add a column to it. --- src/server/Api/Internal/BaseInternalRoute.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/server/Api/Internal/BaseInternalRoute.cs') diff --git a/src/server/Api/Internal/BaseInternalRoute.cs b/src/server/Api/Internal/BaseInternalRoute.cs index 2f92c8e..6c0a2d9 100644 --- a/src/server/Api/Internal/BaseInternalRoute.cs +++ b/src/server/Api/Internal/BaseInternalRoute.cs @@ -5,11 +5,12 @@ namespace IOL.BookmarkThing.Server.Api.Internal; [ApiController] public class BaseInternalRoute : ControllerBase { + /// /// User data for the currently logged on user. /// protected LoggedInInternalUser LoggedInUser => new() { + Id = User.FindFirstValue(ClaimTypes.NameIdentifier).ToGuid(), Username = User.Identity?.Name, - Id = User.Claims.SingleOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value.ToGuid() ?? default }; } -- cgit v1.3