SharePoint Subscription Edition seems to be supporting .Net Framework 4.8.
Based on this article, Beginning with .NET 4.5, System.Security.Claims classes should be used instead of those in the System.IdentityModel.Claims namespace. Probably at some point, Microsoft removed the backwards compatibility.
Check these images for how this change has been done: Identity Model Claims, New Claim Class - based on this, adjust your code.
"ICliamsIdentity extends this interface to access to claims collection. Windows Identity Foundation represents a claim within the Claim class."
In my case all I need to change was:
using Microsoft.IdentityModel.Claims;
to using System.Security.Claims;
((IClaimsIdentity) CurrentPrincipal.Identity)
to (CurrentPrincipal.Identity as ClaimsIdentity)
IClaimsIdentity ClaimsIdentity
references become ClaimsIdentity ClaimsIdentity
Please pay attention to the class differences - some properties have changed: e.g. claim.ClaimType
becomes claim.Type
(claim
is an iteration variable from foreach (Claim claim in ClaimsIdentity.Claims)
Please let me know if this works for you or if I should add more details.