question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Set option "GetClaimsFromUserInfoEndpoint" should go to user info endpoint

See original GitHub issue

Which version of Microsoft Identity Web are you using? Note that to get help, you need to run the latest version. 1.4.1

Where is the issue?

  • Web app
    • [x ] Sign-in users
    • Sign-in users and call web APIs
  • Other (please describe)

Is this a new or an existing app?

a. The app is in production and I have attempted to change from OpenIDConnect middleware to MicrosoftIdentityWebApp middleware.

Repro

var initialScopes = new string[] { "openId", "profile", "User.ReadBasic.All" };
// Sign-in users with the Microsoft identity platform
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
     .AddMicrosoftIdentityWebApp(options =>                
     {   
          Configuration.Bind("AzureAd", options);
          options.GetClaimsFromUserInfoEndpoint = true;
      }, options => { Configuration.Bind("AzureAd", options); })
      .EnableTokenAcquisitionToCallDownstreamApi(options => Configuration.Bind("AzureAd", options), initialScopes)
      .AddMicrosoftGraph(Configuration.GetSection("GraphAPI"))
      .AddInMemoryTokenCaches();

Expected behavior Setting option “GetClaimsFromUserInfoEndpoint” to true actually results in an HTTP request to that endpoint passing the access_token as a bearer, retrieving all additional claims, and adding them to the set of UserClaims.

Actual behavior OpenIdConnetOption of “GetClaimsFromUserInfoEndpoint” is not resulting in actually sending an http request to the UserInfo Endpoint defined in the Discovery/Meta document. For example, our tenant defines the v2.0 userinfo endpoint as “https://graph.microsoft.com/oidc/userinfo”, but that request is never made despite the access_token to do so being received. This works as intended in the standard OpenIdConnect middleware.

Specifically GraphAPI based (such as User.ReadBasic.All) claims are NOT included in the id_token (as expected), but since the call to the userinfo endpoint is not happening, those claims are never retrieved. Once again, if I manually setup the same configuration directly in OpenIdConnect middleware, the correct behavior occurs, and all claims are available.

Possible solution Make the setting option of “GetClaimsFromUserInfoEndpoint = true” on the function .AddMicrosoftIdentityWeb() actually result in calling the endpoint defined in the discovery document.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
blowdartcommented, Feb 1, 2021

I leave this to chris. Presumably there’s an event somewhere where you’ll get the results back and you need to wire that up if the option is set to true.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AddMicrosoftIdentityWebApp Not Retrieving additional ...
but it is NOT using that token to hit the userInfo endpoint and retrieve those claims associated with User.ReadBasic.All. What does this mean?...
Read more >
OpenIdConnectOptions.GetClaimsFromUserInfoEndpoint ...
Boolean to set whether the handler should go to user info endpoint to retrieve additional claims or not after creating an identity from...
Read more >
Mapping, customizing, and transforming claims in ASP. ...
Learn how to map claims, do claims transformations, customize claims.
Read more >
asp.net core 2.0 mvc: groups not showing in jwt
I cannot get "groups" to show up as part of my JWT. When I create a test token on the Okta auth server,...
Read more >
OpenID Connect Client with .NET
The GetClaimsFromUserInfoEndpoint property is used in the code example, to get name details for display from the OAuth user info endpoint. These values...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found