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] Remove the weird pattern for newing up redundant copies of MicrosoftIdentityOptions #239

Closed
jmprieur opened this issue Jun 23, 2020 · 1 comment

Comments

@jmprieur
Copy link
Collaborator

jmprieur commented Jun 23, 2020

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

Where is the issue?

  • Web App
    • [x ] Sign-in users
    • [ x] Sign-in users and call web APIs
  • Web API
    • [x ] Protected web APIs
    • [x ] Protected web APIs call downstream web APIs

Other? - please describe;

Repro

Remove the weird pattern for newing up redundant copies of MicrosoftIdentityOptions
WebApiAuthenticationBuilderExtensions.cs#L85-L88
WebAppAuthenticationBuilderExtensions.cs#L74-L75
WebApiCallsWebApiAuthenticationBuilderExtensions.cs#L63-L66
WebAppCallsWebApiAuthenticationBuilderExtensions.cs#L101-L102

Expected behavior

  • Injecting something IOptions from the container (in 5.0)
  • In 3.1. @chris will provide an ugly work around.

See also #234 which leverages the same mechanism

Proposed design

  1. Use it to get a required service of IOptions.
MicrosoftIdentityOptions microsoftIdentityOptions = serviceProvider.GetRequiredService<IOptions<MicrosoftIdentityOptions>>().Value;
  1. Note that it's not needed to call configureMicrosoftIdentityOptions(microsoftIdentityOptions); because it's called automatically as registered by : https://github.com/AzureAD/microsoft-identity-web/blob/master/src/Microsoft.Identity.Web/WebApiAuthenticationBuilderExtensions.cs#L72
@jennyf19
Copy link
Collaborator

Included in 0.2.0-preview release

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

3 participants