summaryrefslogtreecommitdiffstats
path: root/src/server/Api/Internal/BaseInternalRoute.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/Api/Internal/BaseInternalRoute.cs')
-rw-r--r--src/server/Api/Internal/BaseInternalRoute.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/server/Api/Internal/BaseInternalRoute.cs b/src/server/Api/Internal/BaseInternalRoute.cs
new file mode 100644
index 0000000..2f92c8e
--- /dev/null
+++ b/src/server/Api/Internal/BaseInternalRoute.cs
@@ -0,0 +1,15 @@
+namespace IOL.BookmarkThing.Server.Api.Internal;
+
+/// <inheritdoc />
+[Authorize]
+[ApiController]
+public class BaseInternalRoute : ControllerBase
+{
+ /// <summary>
+ /// User data for the currently logged on user.
+ /// </summary>
+ protected LoggedInInternalUser LoggedInUser => new() {
+ Username = User.Identity?.Name,
+ Id = User.Claims.SingleOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value.ToGuid() ?? default
+ };
+}