Skip to content

[Bug] SingletonTokenAcquisition can be removed #249

Closed

Description

Which Version of Microsoft Identity Web are you using ?
Microsoft Identity Web 0.1.5-preview

AddTokenAcquisition isTokenAcquisitionSingleton parameter (never used)

public static IServiceCollection AddTokenAcquisition(
this IServiceCollection services,
bool isTokenAcquisitionSingleton = false)
is a request from the Microsoft Graph SDK which want a singleton (whereas in general that’s not such a good idea)

See https://github.com/AzureAD/microsoft-identity-web/blob/master/tests/WebAppCallsMicrosoftGraph/appsettings.json#L9

There is an alternative which is that the GraphService registers the ITokenAcquisition as a singleton (the last which does the registration)

Decision:

  • We keep AddTokenAcquisition as is
  • We remove the SingletonTokenAcquisition property from the Microsoft.Identity.Options
  • AddTokenAcquision is called with the default value (false) from the extension methods
  • Remove the tests that were testing this.

Activity

  1. jennyf19 commented on Jul 13, 2020

    @jennyf19
    Collaborator
  2. sviatoslav-vilkovych commented on Sep 11, 2020

    @sviatoslav-vilkovych

    So, there is no more posibility to have TokenAcquisition registered as a Singleton service, right?

  3. pmaytak commented on Sep 11, 2020

    @pmaytak
    Collaborator

    You still can. Call services.AddTokenAcquisition(true) at the end of ConfigureServices method. (The related PRs just removed SingletonTokenAcquisition property from MicrosoftIdentityOptions.)

    public static IServiceCollection AddTokenAcquisition(
    this IServiceCollection services,
    bool isTokenAcquisitionSingleton = false)

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

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions