You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
User.Identity.Name in v.1.9.0 now shows displayname instead of account nameΒ #1136
I understand, Jeffrey Jangli (@Yomodo)
I'm asking if you could add the three package references I provided above to your csproj, in order to see if this still reproes ? I'd like to rule out a change in Microsoft.IdentityModel (as I don't see change in Microsoft.Identity.Web for this)
You will get a
System.NullReferenceException: 'Object reference not set to an instance of an object.'
Reverting back to Microsoft.Identity.Web 1.8.2 resolves issue.
Staying with 1.9.0 and reverting back System.IdentityModel.Tokens.Jwt to 6.8.0
and Microsoft.IdentityModel.Protocols.OpenIdConnect to 6.8.0 also removes the error and returns the proper Name.
jennyf19Travis Neale (@travisneale) while we look into this, in general the pattern: use.FindFirst("<someclaimname>").Value.ToString();
Can always throw a null exception.
It would be helpful to have the jwt token that was used.
To get this app to work: You will need to add domain name, tenant ID, client ID to the appsettings.json file to point to your AzureAD, which will need the app registration with a Redirect URI pointing to https://localhost:44367/signin-oidc (or whatever local host port number you set).
It's currently set to Microsoft.Identity.Web 1.8.2 so that it will work. Update to 1.9.0 to see the error.
I tested w/the sample Travis Neale (@travisneale) provided and seems to work as expected. Would one of you mind confirming? This will be in our next release (1.10).
Activity
jmprieur commentedon Apr 13, 2021
Jeffrey Jangli (@Yomodo) : do you have repro steps?
Yomodo commentedon Apr 13, 2021
This is a .NET 5 blazor server web app.
jmprieur commentedon Apr 13, 2021
Jeffrey Jangli (@Yomodo) : could you please check what happens if you force Microsoft.IdentityModel assemblies to be version="6.8.*" ?
Yomodo commentedon Apr 13, 2021
These are the used package references:
jmprieur commentedon Apr 13, 2021
I understand, Jeffrey Jangli (@Yomodo)
I'm asking if you could add the three package references I provided above to your csproj, in order to see if this still reproes ? I'd like to rule out a change in Microsoft.IdentityModel (as I don't see change in Microsoft.Identity.Web for this)
Yomodo commentedon Apr 13, 2021
Microsoft.Identity.Web 1.9.0:

Microsoft.Identity.Web.UI 1.9.0:

jmprieur commentedon Apr 13, 2021
Thank you very much Jeffrey Jangli (@Yomodo) for trying this.
BrentSchmaltz (@brentschmaltz) Maria Furman (@mafurman) George Krechar (@GeoK) could it be that Wilson 8.10 has changed the mapping of the Name claim?
travisneale commentedon Apr 13, 2021
I think I'm seeing something similar. Downgrading System.IdentityModel.Tokens.Jwt to 6.8.0 resolved my problem.
To repo:
From Blazor server template, connect to Azure AD authentication and using AuthorizeRouteView:
In Index.razor add:
`
Code/OS (@code) {
}`
You will get a
System.NullReferenceException: 'Object reference not set to an instance of an object.'
Reverting back to Microsoft.Identity.Web 1.8.2 resolves issue.
Staying with 1.9.0 and reverting back System.IdentityModel.Tokens.Jwt to 6.8.0
and Microsoft.IdentityModel.Protocols.OpenIdConnect to 6.8.0 also removes the error and returns the proper Name.
jennyf19 commentedon Apr 13, 2021
thanks for the quick update Travis Neale (@travisneale) and investigation.
cc: Jean-Marc Prieur (@jmprieur) George Krechar (@GeoK)
brentschmaltz commentedon Apr 13, 2021
jennyf19 Travis Neale (@travisneale) while we look into this, in general the pattern:
use.FindFirst("<someclaimname>").Value.ToString();Can always throw a null exception.
It would be helpful to have the jwt token that was used.
jennyf19 commentedon Apr 13, 2021
Travis Neale (@travisneale) Jeffrey Jangli (@Yomodo) i'm not able to repro it w/a Blazor server web app, which calls Graph. Can you provide repro code?
Yomodo commentedon Apr 13, 2021
My issue started with the exact same code as provided by Travis Neale (@travisneale).
jmprieur commentedon Apr 13, 2021
Identity.Model just added an issue for this regression: AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#1627
travisneale commentedon Apr 13, 2021
https://github.com/travisneale/MID-1136
To get this app to work: You will need to add domain name, tenant ID, client ID to the appsettings.json file to point to your AzureAD, which will need the app registration with a Redirect URI pointing to https://localhost:44367/signin-oidc (or whatever local host port number you set).
It's currently set to Microsoft.Identity.Web 1.8.2 so that it will work. Update to 1.9.0 to see the error.
jennyf19 commentedon Apr 14, 2021
Travis Neale (@travisneale) the repro was super helpful. thank you so much. we should have a workaround out in our next release 1.9.1 on 4.14.
travisneale commentedon Apr 14, 2021
jennyf19 Thank you for the quick patch!
jmprieur commentedon Apr 14, 2021
Jeffrey Jangli (@Yomodo) Travis Neale (@travisneale) we just released Microsoft.Identity.Web 1.9.1 which works around this issue until IdentityModel provides a definitive fix.
Yomodo commentedon Apr 14, 2021
Thanks a lot everyone!
jennyf19 commentedon Apr 16, 2021
Travis Neale (@travisneale) Jeffrey Jangli (@Yomodo) Are you able to try out this branch which removes the workaround we had in place? BrentSchmaltz (@brentschmaltz) made the fix in Wilson, so I've removed the workaround in MS Id Web and we automatically pick up the latest wilson build (6.10.2 has the fix in this case).
I tested w/the sample Travis Neale (@travisneale) provided and seems to work as expected. Would one of you mind confirming? This will be in our next release (1.10).
cc: Jean-Marc Prieur (@jmprieur)
Yomodo commentedon Apr 16, 2021
Yes, all is fine now. Thanks again!
Fix for #1136 - case insensitive comparison to detect app service env
Fix for #1136 - case insensitive comparison to detect app service env (β¦