Wednesday, July 15, 2020

Claims Identity - Extract UPN from a claim (IIdentity)

A claim with the type IIdentity can contain multiple claims and quite often we may need to extract the value of a particular claim within. This is fairly simple like so:

var email = principal.FindFirst(ClaimTypes.Upn)?.Value;

Reference: https://docs.microsoft.com/en-us/azure/architecture/multitenant-identity/claims

No comments:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...