microsoft-identity-web
microsoft-identity-web copied to clipboard
[Feature Request] Enable MicrosoftIdentityWebAppAuthenticationBuilder extension methods to configure scheme options
Is your feature request related to a problem? Please describe.
It is not possible to write extension methods for the builder returned by .AddMicrosoftIdentityWebApp()
(MicrosoftIdentityWebAppAuthenticationBuilder
) that configure the OpenID Connect scheme's options because the .OpenIdConnectScheme
property has a private
getter.
See here:
https://github.com/AzureAD/microsoft-identity-web/blob/15de647e65280299fbec594957213f2d5b5564bf/src/Microsoft.Identity.Web/WebAppExtensions/MicrosoftIdentityWebAppAuthenticationBuilder.cs#L49
For example, it is not possible to write either of these extension methods:
authenticationBuilder.AddMicrosoftIdentityWebApp(options => { }, "MySchemeName")
.ConfigureClientSecretFromServices()
.PreventSignIn();
Describe the solution you'd like
Give .OpenIdConnectScheme
a public getter.
Describe alternatives you've considered
- Wrap
MicrosoftIdentityWebAppAuthenticationBuilder
with a custom class that properly exposes the OpenID Connect scheme that you can then write extension methods for:
authenticationBuilder.AddMicrosoftIdentityWebApp(options => { }, "MySchemeName")
.WrapWithExtensibleBuilder("MySchemeName")
.ConfigureClientSecretFromServices()
.PreventSignIn();
- Pass the OpenID Connect scheme to every extension method:
authenticationBuilder.AddMicrosoftIdentityWebApp(options => { }, "MySchemeName")
.ConfigureClientSecretFromServices("MySchemeName")
.PreventSignIn("MySchemeName");
Both require repeating the OpenID Connect scheme (which worst case is error prone) and unnecessary and potentially confusing extra typing.