-
Notifications
You must be signed in to change notification settings - Fork 245
Closed
Labels
Description
Microsoft.Identity.Web Library
Microsoft.Identity.Web
Microsoft.Identity.Web version
2.11.1
Web app
Sign-in users
Web API
Protected web APIs (validating tokens)
Token cache serialization
In-memory caches
Description
Current Owin code looks for a very specific claims preferred_username and crash if not present
Reproduction steps
Use Owin ( test/devapps/asp.net MVC/OwinWebApp application ) on Azure AD B2C without this claims.
Error message
System.NullReferenceException
Id Web logs
No response
Relevant code snippets
This is the problematic webcode :
string name = context.AuthenticationTicket.Identity.FindFirst("preferred_username").Value;
Microsoft.identy.web.Owin/AppBuilderExtension.Cs
https://github.com/AzureAD/microsoft-identity-web/blob/master/src/Microsoft.Identity.Web.OWIN/AppBuilderExtension.cs#L180Regression
No response
Expected behavior
Read the the claim name from the ClaimNameType name ?