Skip to content

Commit

Permalink
Change deserialize API
Browse files Browse the repository at this point in the history
  • Loading branch information
ParadoxZero committed Jul 24, 2024
1 parent 7d1f3b8 commit 22c7832
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions api/services/azure_identity_service.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Diagnostics;
using System.Text.Json;
using budgetbud.Services;
using Newtonsoft.Json;

namespace budgetbud.Services;

Expand All @@ -18,7 +16,7 @@ public string GetUserIdentity()
if (_httpContextAccessor.HttpContext != null && _httpContextAccessor.HttpContext!.Request.Headers.TryGetValue("X-MS-CLIENT-PRINCIPAL", out var userId))
{
string decoded_userId = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(userId!));
dynamic claims = JsonSerializer.Deserialize<dynamic>(decoded_userId) ?? throw new Exception("Claims not valid JSON");
dynamic claims = JsonConvert.DeserializeObject(decoded_userId) ?? throw new Exception("Claims not valid JSON");
string provider = claims.provider_name;
switch (provider)
{
Expand Down

0 comments on commit 22c7832

Please sign in to comment.