File tree Expand file tree Collapse file tree 12 files changed +31
-35
lines changed
Expand file tree Collapse file tree 12 files changed +31
-35
lines changed Original file line number Diff line number Diff line change 1616 - name : Setup .NET
1717 uses : actions/setup-dotnet@v1
1818 with :
19- dotnet-version : ' 6 .0'
19+ dotnet-version : ' 7 .0'
2020 include-prerelease : True
2121 - name : Restore dependencies
2222 run : dotnet restore ./content/BlazorBffAzureB2C/Server
Original file line number Diff line number Diff line change 22
33[ Readme] ( https://github.com/damienbod/Blazor.BFF.AzureB2C.Template/blob/main/README.md )
44
5+ ** 2022-12-03** 2.0.0
6+ - Updated packages to .NET 7
7+
58** 2022-09-23** 1.2.4
69- Updated packages
710
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ This template can be used to create a Blazor WASM application hosted in an ASP.N
66
77## Features
88
9- - WASM hosted in ASP.NET Core 6
9+ - WASM hosted in ASP.NET Core 7
1010- BFF with Azure B2C using Microsoft.Identity.Web
1111- OAuth2 and OpenID Connect OIDC
1212- No tokens in the browser
@@ -217,7 +217,7 @@ Further details may be found here [Configure ASP.NET Core to work with proxy ser
217217
218218Please note, adding the 'XForwardedFor' enum as shown in the Microsoft document above did not work and needed to be removed so only the XForwardedProto remains.
219219
220- ## Credits, Used NuGet packages + ASP.NET Core 6 .0 standard packages
220+ ## Credits, Used NuGet packages + ASP.NET Core 7 .0 standard packages
221221
222222- NetEscapades.AspNetCore.SecurityHeaders
223223
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ This template can be used to create a Blazor WASM application hosted in an ASP.N
88
99## Features
1010
11- - WASM hosted in ASP.NET Core 6
11+ - WASM hosted in ASP.NET Core 7
1212- BFF with Azure B2C using Microsoft.Identity.Web
1313- OAuth2 and OpenID Connect OIDC
1414- No tokens in the browser
@@ -198,7 +198,7 @@ nuget pack content/Blazor.BFF.AzureB2C.Template.nuspec
198198Locally built nupkg:
199199
200200```
201- dotnet new -i Blazor.BFF.AzureB2C.Template.1.2.4 .nupkg
201+ dotnet new -i Blazor.BFF.AzureB2C.Template.2.0.0 .nupkg
202202```
203203
204204Local folder:
@@ -215,7 +215,7 @@ https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-register-ap
215215
216216https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-register-applications?tabs=app-reg-ga
217217
218- ## Credits, Used NuGet packages + ASP.NET Core 6 .0 standard packages
218+ ## Credits, Used NuGet packages + ASP.NET Core 7 .0 standard packages
219219
220220- NetEscapades.AspNetCore.SecurityHeaders
221221
Original file line number Diff line number Diff line change 22<package xmlns =" http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd" >
33 <metadata >
44 <id >Blazor.BFF.AzureB2C.Template</id >
5- <version >1.2.4 </version >
5+ <version >2.0.0 </version >
66 <title >Blazor.BFF.AzureB2C.Template</title >
77 <license type =" file" >LICENSE</license >
88 <description >Blazor BFF template for WASM ASP.NET Core hosted</description >
1515 <requireLicenseAcceptance >false</requireLicenseAcceptance >
1616 <copyright >2022 damienbod</copyright >
1717 <summary >This template provides a simple Blazor template with BFF server authentication WASM hosted</summary >
18- <releaseNotes >Updated nuget packages </releaseNotes >
18+ <releaseNotes >Updated to .NET 7 </releaseNotes >
1919 <repository type =" git" url =" https://github.com/damienbod/Blazor.BFF.AzureB2C.Template" />
2020 <packageTypes >
2121 <packageType name =" Template" />
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk.BlazorWebAssembly" >
22
33 <PropertyGroup >
4- <TargetFramework >net6 .0</TargetFramework >
4+ <TargetFramework >net7 .0</TargetFramework >
55 <NoDefaultLaunchSettingsFile >true</NoDefaultLaunchSettingsFile >
66 <Nullable >enable</Nullable >
77 <ImplicitUsings >enable</ImplicitUsings >
88 </PropertyGroup >
99
1010 <ItemGroup >
11- <PackageReference Include =" Microsoft.AspNetCore.Components.WebAssembly" Version =" 6 .0.9 " />
12- <PackageReference Include =" Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version =" 6 .0.9 " PrivateAssets =" all" />
13- <PackageReference Include =" Microsoft.Extensions.Http" Version =" 6 .0.0" />
14- <PackageReference Include =" Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version =" 6 .0.9 " />
11+ <PackageReference Include =" Microsoft.AspNetCore.Components.WebAssembly" Version =" 7 .0.0 " />
12+ <PackageReference Include =" Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version =" 7 .0.0 " PrivateAssets =" all" />
13+ <PackageReference Include =" Microsoft.Extensions.Http" Version =" 7 .0.0" />
14+ <PackageReference Include =" Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version =" 7 .0.0 " />
1515 </ItemGroup >
1616
1717 <ItemGroup >
Original file line number Diff line number Diff line change 99 <div class =" top-row px-4 auth" >
1010 <AuthorizeView >
1111 <Authorized >
12- <strong >Hello, @context ?.User?.Identity?.Name! </strong >
12+ <strong >Hi @context ?.User?.Identity?.Name</strong >
1313 <form method =" post" action =" api/Account/Logout" >
1414 <AntiForgeryTokenInput />
1515 <button class =" btn btn-link" type =" submit" >Sign out</button >
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk.Web" >
22
33 <PropertyGroup >
4- <TargetFramework >net6 .0</TargetFramework >
4+ <TargetFramework >net7 .0</TargetFramework >
55 <Nullable >enable</Nullable >
66 <ImplicitUsings >enable</ImplicitUsings >
77 </PropertyGroup >
1212 </ItemGroup >
1313
1414 <ItemGroup >
15- <PackageReference Include =" Microsoft.AspNetCore.Components.WebAssembly.Server" Version =" 6 .0.9 " />
16- <PackageReference Include =" Microsoft.AspNetCore.Authentication.OpenIdConnect" Version =" 6 .0.9 " NoWarn =" NU1605" />
15+ <PackageReference Include =" Microsoft.AspNetCore.Components.WebAssembly.Server" Version =" 7 .0.0 " />
16+ <PackageReference Include =" Microsoft.AspNetCore.Authentication.OpenIdConnect" Version =" 7 .0.0 " NoWarn =" NU1605" />
1717 <PackageReference Include =" Microsoft.Identity.Web" Version =" 1.25.1" />
1818 <PackageReference Include =" Microsoft.Identity.Web.UI" Version =" 1.25.1" />
1919 <PackageReference Include =" Microsoft.Identity.Web.MicrosoftGraph" Version =" 1.25.1" />
Original file line number Diff line number Diff line change 1212/// </summary>
1313public class CaeClaimsChallengeService
1414{
15- private readonly IConfiguration _configuration ;
16-
17- public CaeClaimsChallengeService ( IConfiguration configuration )
18- {
19- _configuration = configuration ;
20- }
21-
2215 public string ? CheckForRequiredAuthContextIdToken ( string authContextId , HttpContext context )
2316 {
2417 if ( ! string . IsNullOrEmpty ( authContextId ) )
@@ -34,7 +27,6 @@ public CaeClaimsChallengeService(IConfiguration configuration)
3427
3528 if ( acrsClaim ? . Value != authContextId )
3629 {
37- string clientId = _configuration . GetSection ( "AzureAd" ) . GetSection ( "ClientId" ) . Value ;
3830 var cae = "{\" id_token\" :{\" acrs\" :{\" essential\" :true,\" value\" :\" " + authContextId + "\" }}}" ;
3931
4032 return cae ;
@@ -43,5 +35,4 @@ public CaeClaimsChallengeService(IConfiguration configuration)
4335
4436 return null ;
4537 }
46-
4738}
Original file line number Diff line number Diff line change 9292app . UseAuthentication ( ) ;
9393app . UseAuthorization ( ) ;
9494
95- app . UseEndpoints ( endpoints =>
96- {
97- endpoints . MapRazorPages ( ) ;
98- endpoints . MapControllers ( ) ;
99- endpoints . MapNotFound ( "/api/{**segment}" ) ;
100- endpoints . MapFallbackToPage ( "/_Host" ) ;
101- } ) ;
95+ app . MapRazorPages ( ) ;
96+ app . MapControllers ( ) ;
97+ app . MapNotFound ( "/api/{**segment}" ) ;
98+ app . MapFallbackToPage ( "/_Host" ) ;
10299
103100app . Run ( ) ;
You can’t perform that action at this time.
0 commit comments