Skip to content

There is no way to set the DisplayName for the OpenIdConnect providerΒ #808

Closed

Description

Which version of Microsoft Identity Web are you using?
1.3.0

Where is the issue?

  • Other (please describe)

It's not possible to set the display name since the call to AddOpenIdConnect is all done internally here

which doesn't pass in a display name and a display name is not configurable by AuthenticationSchemeOptions

Is this a new or an existing app?
c. This is a new app or an experiment.

Expected behavior
There should be a parameter in AddMicrosoftIdentityWebApp to supply a DisplayName

Actual behavior
There is not an option to do this

Activity

  1. Shazwazza commented on Dec 4, 2020

    @Shazwazza
    ContributorAuthor

    I'm happy to send a PR to add this

  2. jmprieur commented on Dec 4, 2020

    @jmprieur
    Collaborator

    The display name (of the signed-in user, I'm assuming) is inferred from the claims which are in the IDToken. There is no need to specify it externally. What is your scenario? what are you trying to do?. In which case would you want to override a display name which is not in the claims?

    To answer your question:

    1. you have full control of your UI anyway. When you unfold one of the ASP.NET Core templates, the page displaying the name is Pages/Shared/_LoginPartial, which is in the code of your app (not in the framework / the library).

    2. if you don't want to change the UI, the display comes from the options.TokenValidationParameters.NameClaimType

      if (microsoftIdentityOptions.Value.IsB2C)
      {
      options.TokenValidationParameters.NameClaimType = ClaimConstants.Name;
      }
      else
      {
      options.TokenValidationParameters.NameClaimType = ClaimConstants.PreferredUserName;
      }

      You can always override after calling AddMicrosoftIdentityWebApp

      services.Configure<OpenIdConnectOptions>(OpenIdConnectDefaults.AuthenticationScheme, options =>
      {
          options.TokenValidationParameters.NameClaimType = nameOfTheClaimYouWantToUse;
      });
  3. Shazwazza commented on Dec 7, 2020

    @Shazwazza
    ContributorAuthor

    Hi there, what I am referring to by DisplayName is the display name of the provider.

    The code is what I mentioned above with this call builder.AddOpenIdConnect. This method has an optional displayName parameter which must be set via this call as its not settable by any options configuration. This is the overload I'm referring to which sets "A display name for the authentication handler."

  4. jmprieur commented on Dec 7, 2020

    @jmprieur
    Collaborator

    Thanks for the update, Shannon Deminick (@Shazwazza)
    This makes sense.

  5. farshidmirza commented on Dec 8, 2020

    @farshidmirza

    I have this problem as well, we cannot set the provider display name

  6. jmprieur commented on Dec 8, 2020

    @jmprieur
    Collaborator

    Shannon Deminick (@Shazwazza) @farshid3003
    would it work if we predefined a better name like "Microsoft identity platform" ? or "Azure active directory" ? or do you need to provide your own label? (what would it be?)

  7. Shazwazza commented on Dec 8, 2020

    @Shazwazza
    ContributorAuthor

    Jean-Marc Prieur (@jmprieur) Since this lib can be used as boilerplate configuration for Azure B2C then the label could really be anything since B2C is a white label auth system that can be branded in any way.

  8. 18 remaining items

  9. jmprieur commented on Jun 2, 2021

    @jmprieur
    Collaborator

    Chris Ross (@Tratcher) FYI we still need to do that.

  10. modified the milestones: 1.13.0, 1.14 on Jun 11, 2021
  11. modified the milestones: 1.14, 1.15 on Jun 23, 2021
  12. removed this from the 1.14.1 milestone on Jul 14, 2021
  13. jennyf19 commented on Aug 4, 2021

    @jennyf19
    Collaborator

    I have a branch: https://github.com/AzureAD/microsoft-identity-web/tree/jennyf/displayName
    with the changes to handle providing the DisplayName, if you want to try it out. Still a work in progress.
    Shannon Deminick (@Shazwazza) Armand Pondman (@apondman) Jimmie Houts (@theyo) @farshid3003

  14. added this to the 1.16 milestone on Aug 5, 2021
  15. jennyf19 commented on Aug 19, 2021

    @jennyf19
    Collaborator

    Included in 1.16 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions