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
var email = principal.FindFirst(ClaimTypes.Upn)?.Value;
Reference: https://docs.microsoft.com/en-us/azure/architecture/multitenant-identity/claims
No comments:
Post a Comment