Pritorian
Pritorian

Reputation: 450

Blazor 8 united + Azure b2c

So I was looking at the latest version of blazor application and noticed, that there is no template for blazor web app (I assume this is a goto template for the hybrid hosting model) that incorporates b2c from teh get go (unlike older wasm or server templates).

In a few tracks on github I also discovered that not everybody was able to work with that and there is a track to update documentation, but that section is not completed yet.

Does anybody know where can I get a comprehensive guide on how to actually make it work with B2C if I start from a template with no authorization (since Identity is clearly not that I need and there is no other option for now at least)? Assuming B2C tenant is in place and custom policies are working (in terms that jwt.ms can parse a token with custom claims)? Mb some useful repositories to look for and copy their Program.cs setup?

Thanks you in advance.

Upvotes: 1

Views: 409

Answers (1)

Harshitha
Harshitha

Reputation: 7347

Yes, In the template you can only see the option for Individual Accounts.

We have an option to add Microsoft Identity Platform from Connected Services (Code related to Authentication gets generated automatically by configuring this)- Works in all the previous versions.

enter image description here

enter image description here

  • I am trying to configure the same in .NET 8 Blazor Web App.

  • I have added in both Web and Client App.

Observations when added in Web App:

  • .csproj is updated with the below packages.
  <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.0" />
    <PackageReference Include="Microsoft.Identity.Web" Version="2.13.4" />
    <PackageReference Include="Microsoft.Identity.Web.UI" Version="2.13.4" />

Configurations: enter image description here

  • There are no changes in Program.cs and appsettings.json file.

Observations when added in ClientApp:

  • .csproj file is updated with the below package.
  <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
  <PackageReference Include="Microsoft.Authentication.WebAssembly.Msal" Version="8.0.0" />
  • But I do not see any code related to Program.cs file in both Web and Client Apps.
  • Even I do not find any documents related to Web App Authentication.
  • All the docs explain about the Blazor WASM.
  • AFAIK,there is no full support for the .NET 8 Blazor Web App.

Even this MSDoc explains the Authentication only for Blazor WASM and Server Applications.

Upvotes: 2

Related Questions