diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-01-30 01:30:58 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-01-30 01:30:58 +0100 |
| commit | bda1e81c87a34bc0e6d2ce805f706a726087e957 (patch) | |
| tree | 124ebf09d1289900e0d67d8723528b96bfbb6a7e /src/server/Api/Internal/Account/GetClaimsRoute.cs | |
| parent | 253c8479b9ae0ba6853a70728d3f6e904e1ac2ba (diff) | |
| download | bookmark-thing-bda1e81c87a34bc0e6d2ce805f706a726087e957.tar.xz bookmark-thing-bda1e81c87a34bc0e6d2ce805f706a726087e957.zip | |
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.
Diffstat (limited to 'src/server/Api/Internal/Account/GetClaimsRoute.cs')
| -rw-r--r-- | src/server/Api/Internal/Account/GetClaimsRoute.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/server/Api/Internal/Account/GetClaimsRoute.cs b/src/server/Api/Internal/Account/GetClaimsRoute.cs new file mode 100644 index 0000000..fde8887 --- /dev/null +++ b/src/server/Api/Internal/Account/GetClaimsRoute.cs @@ -0,0 +1,16 @@ +namespace IOL.BookmarkThing.Server.Api.Internal.Account; + +public class GetClaimsRoute : RouteBaseInternalSync.WithoutRequest.WithActionResult +{ + [HttpGet("~/v{apiVersion:apiVersion}/account/claims")] + public override ActionResult Handle() { + if (HttpContext.Request.Query.ContainsKey("download")) { + var serializerOptions = new JsonSerializerOptions() { + ReferenceHandler = ReferenceHandler.IgnoreCycles + }; + return File(JsonSerializer.SerializeToUtf8Bytes(User.Claims, serializerOptions), "application/json", "claims_" + User.Identity?.Name + ".json"); + } + + return Ok(User.Claims); + } +} |
