Microsoft-identity-web: AddSignIn should be more robust to authority having or not a trailing slash.

Created on 18 Feb 2020  路  8Comments  路  Source: AzureAD/microsoft-identity-web

WebApiAuthenticationBuilderExtensions.EnsureAuthorityIsV2_0 was extracted from the WebApiAuthenticationBuilderExtensions.AddProtectedWebAPi method so that we can unit test it. I think it should stay there as this method takes a JwtBearerOptions parameter and It's unit tested.

It provides a more robust processing of authorities accepting them to end in / or not.

We want to do somthing similar for WebAppAuthenticationBuilderExtensions.AddSignIn( this AuthenticationBuilder builder, Action<OpenIdConnectOptions> configureOpenIdConnectOptions, Action<MicrosoftIdentityOptions> configureMicrosoftIdentityOptions, string openIdConnectScheme = OpenIdConnectDefaults.AuthenticationScheme, string cookieScheme = CookieAuthenticationDefaults.AuthenticationScheme, bool subscribeToOpenIdConnectMiddlewareDiagnosticsEvents = false), but with a method enabling an OpenIdConnectOptions.

P2 bug fixed

All 8 comments

included in 0.1.1-preview release

Only reference I can find to it, so I'll ask here. If you'd prefer I open an issue, then I will.

Following the current guides / tutorials when I attempt to launch my application I get the following error

An unhandled exception occurred while processing the request.
NullReferenceException: Object reference not set to an instance of an object.
Microsoft.Identity.Web.AuthorityHelpers.EnsureAuthorityIsV2(string authority)

@wowfood yes, please open another issue here. Can you also include your appsettings.json file (just remove any sensitive information)? Thank you.

I figured out the issue in the end. It was a typo in the AppSettings.JSON.

Switching to a local version of the project made the error much more obvious, once I've got things up and running correctly I'll have another go at using the nuget package instead. Thanks for the quick reply though.

@wowfood Thanks for the follow-up. I think we can make a better error message, so you don't need to do come here for help. @jmprieur -> thoughts?

Actually, @wowfood , we already have an issue tracking this: https://github.com/AzureAD/microsoft-identity-web/issues/66

@wowfood : just to be sure, in which part (property) of the AppSettings.json did you have the typo? (#66 is for the app secret, but It's not clear fromt this thread that this is where you had the typo?)

It wasn't the secret, I'd mistyped the actual section, instead of calling it AzureAdB2C I'd called it AzureAB2C, so technically the issue was it wasn't finding any of it. I'll be honest, for IDs and stuff I'd much prefer something strongly typed. (But that's a me issue, not a package issue)

Was this page helpful?
0 / 5 - 0 ratings