Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] SingletonTokenAcquisition can be removed #249

Closed
jmprieur opened this issue Jun 24, 2020 · 3 comments
Closed

[Bug] SingletonTokenAcquisition can be removed #249

jmprieur opened this issue Jun 24, 2020 · 3 comments

Comments

@jmprieur
Copy link
Collaborator

jmprieur commented Jun 24, 2020

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.
@jennyf19
Copy link
Collaborator

Included in 0.2.0-preview release

@sviatoslav-vilkovych
Copy link

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

@pmaytak
Copy link
Contributor

pmaytak commented Sep 11, 2020

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
Projects
None yet
Development

No branches or pull requests

4 participants