Skip to content

Commit

Permalink
Fix NameIdentifier is not an integer. (TryParse implemented) (#17414)
Browse files Browse the repository at this point in the history
Issue: 17383
  • Loading branch information
Oxygen-cl authored Nov 8, 2024
1 parent ee37ad0 commit 2709054
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Umbraco.Core/Extensions/ClaimsIdentityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,10 @@ public static string[] GetAllowedApplications(this ClaimsIdentity identity) => i
var firstValue = identity.FindFirstValue(ClaimTypes.NameIdentifier);
if (firstValue is not null)
{
return int.Parse(firstValue, CultureInfo.InvariantCulture);
if (int.TryParse(firstValue, CultureInfo.InvariantCulture, out var id))
{
return id;
}
}

return null;
Expand Down

0 comments on commit 2709054

Please sign in to comment.