From d1f96fb8cf1ea95d3b83db1102593217d1df80ae Mon Sep 17 00:00:00 2001 From: Duende Bot Date: Thu, 21 May 2026 19:00:39 +0000 Subject: [PATCH] Publish - 2026-05-21 19:00:05 UTC --- bff/bff.slnf | 1 + bff/docs/.$Bff Multi Frontend.svg.dtmp | 4 - bff/docs/Bff Multi Frontend.svg | 4 - bff/docs/bff-plugin.svg | 959 ------------------ bff/docs/upgrade-guide.md | 110 -- bff/hosts/Hosts.AppHost/Hosts.AppHost.csproj | 2 +- .../Hosts.AppHost.net8.0.v3.ncrunchproject | 5 - .../Hosts.AppHost.net9.0.v3.ncrunchproject | 5 - .../Hosts.AppHost.v3.ncrunchproject | 5 - .../Pages/Device/Index.cshtml | 11 - .../Pages/Device/Index.cshtml.cs | 9 +- .../Pages/Device/InputModel.cs | 1 - .../Pages/Device/ViewModel.cs | 2 - .../Hosts.ServiceDefaults.csproj | 2 +- .../Bff.Benchmarks.net8.0.v3.ncrunchproject | 7 - .../Bff.Benchmarks.net9.0.v3.ncrunchproject | 7 - .../Internals/FetchUserService.cs | 5 +- .../Bff.EntityFramework/SessionDbContext.cs | 3 + .../BffBlazorAutoRenderMode/Program.cs | 6 + .../src/BffLocalApi/HostingExtensions.cs | 7 + bff/templates/src/BffRemoteApi/Program.cs | 5 + bff/test/Bff.Tests/AssemblyInfo.cs | 4 - .../Bff.Tests.net8.0.v3.ncrunchproject | 143 --- .../Bff.Tests.net9.0.v3.ncrunchproject | 7 - bff/test/Hosts.Tests/AssemblyInfo.cs | 4 - .../Hosts.Tests/Hosts.Tests.v3.ncrunchproject | 7 - 26 files changed, 30 insertions(+), 1295 deletions(-) delete mode 100644 bff/docs/.$Bff Multi Frontend.svg.dtmp delete mode 100644 bff/docs/Bff Multi Frontend.svg delete mode 100644 bff/docs/bff-plugin.svg delete mode 100644 bff/docs/upgrade-guide.md delete mode 100644 bff/hosts/Hosts.AppHost/Hosts.AppHost.net8.0.v3.ncrunchproject delete mode 100644 bff/hosts/Hosts.AppHost/Hosts.AppHost.net9.0.v3.ncrunchproject delete mode 100644 bff/hosts/Hosts.AppHost/Hosts.AppHost.v3.ncrunchproject delete mode 100644 bff/performance/Bff.Benchmarks/Bff.Benchmarks.net8.0.v3.ncrunchproject delete mode 100644 bff/performance/Bff.Benchmarks/Bff.Benchmarks.net9.0.v3.ncrunchproject delete mode 100644 bff/test/Bff.Tests/AssemblyInfo.cs delete mode 100644 bff/test/Bff.Tests/Bff.Tests.net8.0.v3.ncrunchproject delete mode 100644 bff/test/Bff.Tests/Bff.Tests.net9.0.v3.ncrunchproject delete mode 100644 bff/test/Hosts.Tests/AssemblyInfo.cs delete mode 100644 bff/test/Hosts.Tests/Hosts.Tests.v3.ncrunchproject diff --git a/bff/bff.slnf b/bff/bff.slnf index 74a486961..ff4ee240d 100644 --- a/bff/bff.slnf +++ b/bff/bff.slnf @@ -31,6 +31,7 @@ "bff\\templates\\src\\BffRemoteApi\\BffRemoteApi.csproj", "bff\\test\\Bff.Tests\\Bff.Tests.csproj", "bff\\test\\Hosts.Tests\\Hosts.Tests.csproj", + "shared\\AppHost.Abstractions\\AppHost.Abstractions.csproj", "shared\\ShouldlyExtensions\\ShouldlyExtensions.csproj", "shared\\Xunit.Playwright\\Xunit.Playwright.csproj" ] diff --git a/bff/docs/.$Bff Multi Frontend.svg.dtmp b/bff/docs/.$Bff Multi Frontend.svg.dtmp deleted file mode 100644 index da58efa6b..000000000 --- a/bff/docs/.$Bff Multi Frontend.svg.dtmp +++ /dev/null @@ -1,4 +0,0 @@ - - - -
Get
Get
BffAuthentication
SchemeProvider
BffAuthentication...
GetHandlerSchemes
GetHandlerSchemes
Get
Get
Match
Match
BffSignin
Middleware
BffSignin...
Services
Services
App
App
AddBff
AddBff
Set Default BFF Schemes
Set Default BFF Schemes
ConfigureBffAuthenticationOptions
: IPostConfigureOptions<AuthenticationOptions>
ConfigureBffAuthenticationOptions...
AuthenticationOptions
AuthenticationOptions
Configure 
For Frontend
Configure...
Get
Get
BffConfigureOpenIdConnectOptions
: IConfigureNamedOptions<OpenIdConnectOptions>
BffConfigureOpenIdConnectOptions...
Set
Set
OpenIdConnectOptions
OpenIdConnectOptions
BffAuthenticationScheme
(OpenIdConnectHandler)
BffAuthenticationScheme...
BffAuthenticationScheme
(CookieHandler)
BffAuthenticationScheme...
Configure
For
Frontend
Configure...
Get
Get
BFFConfigureCookieOptions
: IConfigureNamedOptions<CookieAuthenticationOptions>
BFFConfigureCookieOptions...
CookieOptions
CookieOptions
FrontendStore
FrontendStore
Set
Selected
Set...
Find
Matching
Frontend
Find...
BffFrontendSelection
Middleware
BffFrontendSelection...
FrontendSelector
FrontendSelector
HttpContext
HttpContext
BffFrontend
SigninPath
BffFrontend...
Text is not SVG - cannot display
\ No newline at end of file diff --git a/bff/docs/Bff Multi Frontend.svg b/bff/docs/Bff Multi Frontend.svg deleted file mode 100644 index a00baa7d0..000000000 --- a/bff/docs/Bff Multi Frontend.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - -
AuthenticationSchemeProvider
AuthenticationSchemeProvider
Adds cookie scheme
Adds cookie scheme
AddCookies
(defaultScheme)
AddCookies...
Adds OpenID
Connect
Scheme
Adds OpenID...
AddOpenIdConnect
(DefaultChallengeScheme)
AddOpenIdConnect...
GetHandlerSchemes
GetHandlerSchemes
Authentication
Middleware
Authentication...
Services
Services
App
App
Text is not SVG - cannot display
\ No newline at end of file diff --git a/bff/docs/bff-plugin.svg b/bff/docs/bff-plugin.svg deleted file mode 100644 index d0cbc16c1..000000000 --- a/bff/docs/bff-plugin.svg +++ /dev/null @@ -1,959 +0,0 @@ - - - - - - - - - - - - -
-
-
- BFF -
-
-
-
- - BFF - -
-
-
- - - - - - - - - - - -
-
-
- BffConfiguration -
-
-
-
- - BffConfiguration - -
-
-
- - - - - - - - - - - -
-
-
- BffFrontend -
-
-
-
- - BffFrontend - -
-
-
- - - - - - - -
-
-
- IDataExtensions -
-
-
-
- - IDataExtensions - -
-
-
- - - - - - - - - -
-
-
- FrontendConfiguration -
-
-
-
- - FrontendConfiguration - -
-
-
- - - - - - - -
-
-
- IndexHtmlUrl -
-
-
-
- - IndexHtmlUrl - -
-
-
- - - - - - - -
-
-
- OpenIdConnectConfiguration -
-
-
-
- - OpenIdConnectConfigura... - -
-
-
- - - - - - - -
-
-
- CookieConfiguration -
-
-
-
- - CookieConfiguration - -
-
-
- - - - - - - -
-
-
- IDataExtensionLoader -
-
-
-
- - IDataExtensionLoader - -
-
-
- - - - - - - -
-
-
- BffBuilder -
-
-
-
- - BffBuilder - -
-
-
- - - - - - - - -
-
-
- <<Uses>> -
-
-
-
- - <<Uses>> - -
-
-
- - - - - - - - -
-
-
- <<contains>> -
-
-
-
- - <<contains>> - -
-
-
- - - - - - - -
-
-
- FrontendCollection -
-
-
-
- - FrontendCollection - -
-
-
- - - - - - - - - -
-
-
- Bff.Yarp -
-
-
-
- - Bff.Yarp - -
-
-
- - - - - - - - - - - -
-
-
- ProxyConfiguration -
-
-
-
- - ProxyConfiguration - -
-
-
- - - - - - - - - - - -
-
-
- BffFrontend -
- - .AddRemoteApi() - -
- <<extension>> -
-
-
-
- - BffFrontend... - -
-
-
- - - - - - - - - -
-
-
- RemoteApi -
-
-
-
- - RemoteApi - -
-
-
- - - - - - - -
-
-
- PathMatch -
-
-
-
- - PathMatch - -
-
-
- - - - - - - -
-
-
- RemoteUrl -
-
-
-
- - RemoteUrl - -
-
-
- - - - - - - - - -
-
-
- RemoteApiConfiguration -
-
-
-
- - RemoteApiConfiguration - -
-
-
- - - - - - - -
-
-
- PathMatch -
-
-
-
- - PathMatch - -
-
-
- - - - - - - -
-
-
- RemoteUrl -
-
-
-
- - RemoteUrl - -
-
-
- - - - - - - - -
-
-
- Loads -
-
-
-
- - Loads - -
-
-
- - - - - - - - -
-
-
- Builds -
-
-
-
- - Builds - -
-
-
- - - - - - - -
-
-
- Proxy -
- DataExtensionLoader -
-
-
-
- - Proxy... - -
-
-
- - - - - - - -
-
-
- ConfigLoader -
- (delegate) -
-
-
-
-
- - ConfigLoader... - -
-
-
- - - - - - - - -
-
-
- Register -
-
-
-
- - Register - -
-
-
- - - - - - - - -
-
-
- Register -
-
-
-
- - Register - -
-
-
- - - - - - - -
-
-
- BffBuilder. -
- - AddRemoteApis() - -
- <<extension>> -
-
-
-
- - BffBuilder.... - -
-
-
- - - - - - - - - - - -
-
-
- ConfigFile -
-
-
-
- - ConfigFile - -
-
-
- - - - - - - - - - - -
-
-
- Frontends -
-
-
-
- - Frontends - -
-
-
- - - - - - - - - -
-
-
- Frontend "one" -
-
-
-
- - Frontend "one" - -
-
-
- - - - - - - -
-
-
- IndexHTMLUrl = "..." -
-
-
-
- - IndexHTMLUrl = "..." - -
-
-
- - - - - - - -
-
-
- OpenIDConnectConfiguration = "..." -
-
-
-
- - OpenIDConnectConfiguration = "..." - -
-
-
- - - - - - - -
-
-
- CookieConfiguration = "..." -
-
-
-
- - CookieConfiguration = "..." - -
-
-
- - - - - - - - - -
-
-
- RemoteApis -
-
-
-
- - RemoteApis - -
-
-
- - - - - - - -
-
-
- PathMatch = "..." -
-
-
-
- - PathMatch = "..." - -
-
-
- - - - - - - -
-
-
- RemotURL = "..." -
-
-
-
- - RemotURL = "..." - -
-
-
- - - - - - - - -
-
-
- <<Implements>> -
-
-
-
- - <<Implements>> - -
-
-
- - - - - - - - -
-
-
- <<Implements>> -
-
-
-
- - <<Implements>> - -
-
-
- - - - - - - -
-
-
- One Merged Config File -
-
-
-
- - One Merged Conf... - -
-
-
- - - - - - - - -
-
-
- <<injects>> -
-
-
-
- - <<injects>> - -
-
-
-
- - - - - Text is not SVG - cannot display - - - -
\ No newline at end of file diff --git a/bff/docs/upgrade-guide.md b/bff/docs/upgrade-guide.md deleted file mode 100644 index 979c89fff..000000000 --- a/bff/docs/upgrade-guide.md +++ /dev/null @@ -1,110 +0,0 @@ -# Upgrade guide - -## From v2.x => v3.x - -If you rely on the default extension methods for wiring up the BFF, then V3 should be a drop-in replacement. - -### Migrating from custom implementations of IHttpMessageInvokerFactory - -In Duende.BFF V2, there was an interface called IHttpMessageInvokerFactory. This class was responsible for creating -and wiring up yarp's HttpMessageInvoker. This interface has been removed in favor yarp's IForwarderHttpClientFactory. - -One common scenario for creating a custom implementation of this class was for mocking the http client -during unit testing. - -If you wish to inject a http handler for unit testing, you should now inject a custom IForwarderHttpClientFactory. For example: - -``` c# - // A Forwarder factory that forwards the messages to a message handler (which can be easily retrieved from a testhost) - public class BackChannelHttpMessageInvokerFactory(HttpMessageHandler backChannel) - : IForwarderHttpClientFactory - { - public HttpMessageInvoker CreateClient(ForwarderHttpClientContext context) => - new HttpMessageInvoker(backChannel); - } - - // Wire up the forwarder in your application's test host: - services.AddSingleton( - new BackChannelHttpMessageInvokerFactory(_apiHost.Server.CreateHandler())); - - -``` - -### Migrating from custom implementations IHttpTransformerFactory -The *IHttpTransformerFactory* was a way to globally configure the YARP tranform pipeline. In V3, the way that -the default *endpoints.MapRemoteBffApiEndpoint()* method builds up the YARP transform has been simplified -significantly. Most of the logic has been pushed down to the *AccessTokenRequestTransform*. - -Here are common scenario's for implementing your own *IHttpTransformerFactory* and how to upgrade: - -**Replacing defaults** - -If you used a custom implementation of IHttpTransformerFactory to change the default behavior of *MapRemoteBffApiEndpoint()*, -for example to add additional transforms, then you can now inject a custom delegate into the di container: - -``` -services.AddSingleton(CustomDefaultYarpTransforms); - -//... - -// This is an example of how to add a response header to ALL invocations of MapRemoteBffApiEndpoint() -private void CustomDefaultBffTransformBuilder(string pathMatch, TransformBuilderContext context) -{ - context.AddResponseHeader("added-by-custom-default-transform", "some-value"); - DefaultBffYarpTransformerBuilders.DirectProxyWithAccessToken(pathMatch, context); -} -``` - -Another way of doing this is to create a custom extensionmethod *MyCustomMapRemoteBffApiEndpoint()* that wraps -the MapRemoteBffApiEndpoint() and use that everywhere in your application. This is a great way to add other defaults -that should apply to all endpoints, such as requiring a specific type of access token. - -**Configuring transforms for a single route** -Another common usecase for overriding the IHttpTransformerFactory was to have a custom transform for a single route, by -applying a switch statement and testing for specific routes. - -Now, there is an overload on the *endpoints.MapRemoteBffApiEndpoint()* that allows you to configure the pipeline directly: - -``` c# - - endpoints.MapRemoteBffApiEndpoint( - "/local-path", - _apiHost.Url(), - context => - { - // do something custom: IE: copy request headers - context.CopyRequestHeaders = true; - - // wire up the default transformer logic - DefaultTransformers.DirectProxyWithAccessToken("/local-path", context); - }) - // Continue with normal BFF configuration, for example, allowing optional user access tokens - .WithOptionalUserAccessToken(); - -``` - -### Removed method RemoteApiEndpoint.Map(localpath, apiAddress). -The Map method was no longer needed as most of the logic had been moved to either the MapRemoteBffApiEndpoint and the DefaultTransformers. The map method also wasn't very explicit about what it did and a number of test scenario's tried to verify if it wasn't called wrongly. You are now expected to call the method MapRemoteBffApiEndpoint. This method now has a nullable parameter that allows you to inject your own transformers. - -### AccessTokenRetrievalContext properties are now typed -The PathMatch and ApiAddress properties are now typed. They used to be strings. If you rely on these, for example for implementing -a custom IAccessTokenRetriever, then you should adjust their usage accordingly. - - /// - /// The locally requested path. - /// - public required PathString PathMatch { get; set; } - - /// - /// The remote address of the API. - /// - public required Uri ApiAddress { get; set; } - -### AddAddEntityFrameworkServerSideSessionsServices has been renamed to AddEntityFrameworkServerSideSessionsServices - -If you used the method AddAddEntityFrameworkServerSideSessionsServices() in your code, please replace it with the corrected AddEntityFrameworkServerSideSessionsServices() - -### StateProviderPollingDelay and StateProviderPollingInterval have been split into separate options for WebAssembly and Server. - -If you used BffBlazorOptions.StateProviderPollingInterval or BffBlazorOptions.StateProviderPollingDelay to configure different polling settings, you should now consider if this same setting applies to either Server, WASM or both. Set the appropriate properties accordingly. - diff --git a/bff/hosts/Hosts.AppHost/Hosts.AppHost.csproj b/bff/hosts/Hosts.AppHost/Hosts.AppHost.csproj index 101e5239c..0811ba659 100644 --- a/bff/hosts/Hosts.AppHost/Hosts.AppHost.csproj +++ b/bff/hosts/Hosts.AppHost/Hosts.AppHost.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/bff/hosts/Hosts.AppHost/Hosts.AppHost.net8.0.v3.ncrunchproject b/bff/hosts/Hosts.AppHost/Hosts.AppHost.net8.0.v3.ncrunchproject deleted file mode 100644 index 319cd523c..000000000 --- a/bff/hosts/Hosts.AppHost/Hosts.AppHost.net8.0.v3.ncrunchproject +++ /dev/null @@ -1,5 +0,0 @@ - - - True - - \ No newline at end of file diff --git a/bff/hosts/Hosts.AppHost/Hosts.AppHost.net9.0.v3.ncrunchproject b/bff/hosts/Hosts.AppHost/Hosts.AppHost.net9.0.v3.ncrunchproject deleted file mode 100644 index 319cd523c..000000000 --- a/bff/hosts/Hosts.AppHost/Hosts.AppHost.net9.0.v3.ncrunchproject +++ /dev/null @@ -1,5 +0,0 @@ - - - True - - \ No newline at end of file diff --git a/bff/hosts/Hosts.AppHost/Hosts.AppHost.v3.ncrunchproject b/bff/hosts/Hosts.AppHost/Hosts.AppHost.v3.ncrunchproject deleted file mode 100644 index 319cd523c..000000000 --- a/bff/hosts/Hosts.AppHost/Hosts.AppHost.v3.ncrunchproject +++ /dev/null @@ -1,5 +0,0 @@ - - - True - - \ No newline at end of file diff --git a/bff/hosts/Hosts.IdentityServer/Pages/Device/Index.cshtml b/bff/hosts/Hosts.IdentityServer/Pages/Device/Index.cshtml index 1dabae4d2..65332113e 100644 --- a/bff/hosts/Hosts.IdentityServer/Pages/Device/Index.cshtml +++ b/bff/hosts/Hosts.IdentityServer/Pages/Device/Index.cshtml @@ -107,17 +107,6 @@ else - @if (Model.View.AllowRememberConsent) - { -
-
- - -
-
- } diff --git a/bff/hosts/Hosts.IdentityServer/Pages/Device/Index.cshtml.cs b/bff/hosts/Hosts.IdentityServer/Pages/Device/Index.cshtml.cs index f8fdce149..d1db82ee4 100644 --- a/bff/hosts/Hosts.IdentityServer/Pages/Device/Index.cshtml.cs +++ b/bff/hosts/Hosts.IdentityServer/Pages/Device/Index.cshtml.cs @@ -41,7 +41,7 @@ public class Index : PageModel [BindProperty] public InputModel Input { get; set; } - public async Task OnGet(string userCode) + public async Task OnGetAsync(string userCode) { if (string.IsNullOrWhiteSpace(userCode)) { @@ -67,7 +67,7 @@ public class Index : PageModel return Page(); } - public async Task OnPost() + public async Task OnPostAsync() { var request = await _interaction.GetAuthorizationContextAsync(Input.UserCode); if (request == null) @@ -102,7 +102,7 @@ public class Index : PageModel grantedConsent = new ConsentResponse { - RememberConsent = Input.RememberConsent, + RememberConsent = false, ScopesValuesConsented = scopes.ToArray(), Description = Input.Description }; @@ -152,8 +152,7 @@ public class Index : PageModel { ClientName = request.Client.ClientName ?? request.Client.ClientId, ClientUrl = request.Client.ClientUri, - ClientLogoUrl = request.Client.LogoUri, - AllowRememberConsent = request.Client.AllowRememberConsent + ClientLogoUrl = request.Client.LogoUri }; vm.IdentityScopes = request.ValidatedResources.Resources.IdentityResources.Select(x => CreateScopeViewModel(x, model == null || model.ScopesConsented?.Contains(x.Name) == true)).ToArray(); diff --git a/bff/hosts/Hosts.IdentityServer/Pages/Device/InputModel.cs b/bff/hosts/Hosts.IdentityServer/Pages/Device/InputModel.cs index 9349e8370..00025dd3a 100644 --- a/bff/hosts/Hosts.IdentityServer/Pages/Device/InputModel.cs +++ b/bff/hosts/Hosts.IdentityServer/Pages/Device/InputModel.cs @@ -7,7 +7,6 @@ public class InputModel { public string Button { get; set; } public IEnumerable ScopesConsented { get; set; } - public bool RememberConsent { get; set; } = true; public string ReturnUrl { get; set; } public string Description { get; set; } public string UserCode { get; set; } diff --git a/bff/hosts/Hosts.IdentityServer/Pages/Device/ViewModel.cs b/bff/hosts/Hosts.IdentityServer/Pages/Device/ViewModel.cs index 520f13dd2..a1c543cd0 100644 --- a/bff/hosts/Hosts.IdentityServer/Pages/Device/ViewModel.cs +++ b/bff/hosts/Hosts.IdentityServer/Pages/Device/ViewModel.cs @@ -8,8 +8,6 @@ public class ViewModel public string ClientName { get; set; } public string ClientUrl { get; set; } public string ClientLogoUrl { get; set; } - public bool AllowRememberConsent { get; set; } - public IEnumerable IdentityScopes { get; set; } public IEnumerable ApiScopes { get; set; } } diff --git a/bff/hosts/Hosts.ServiceDefaults/Hosts.ServiceDefaults.csproj b/bff/hosts/Hosts.ServiceDefaults/Hosts.ServiceDefaults.csproj index 330420c00..8b9bc846d 100644 --- a/bff/hosts/Hosts.ServiceDefaults/Hosts.ServiceDefaults.csproj +++ b/bff/hosts/Hosts.ServiceDefaults/Hosts.ServiceDefaults.csproj @@ -18,7 +18,7 @@ - + diff --git a/bff/performance/Bff.Benchmarks/Bff.Benchmarks.net8.0.v3.ncrunchproject b/bff/performance/Bff.Benchmarks/Bff.Benchmarks.net8.0.v3.ncrunchproject deleted file mode 100644 index 4b1d0cbb0..000000000 --- a/bff/performance/Bff.Benchmarks/Bff.Benchmarks.net8.0.v3.ncrunchproject +++ /dev/null @@ -1,7 +0,0 @@ - - - - AspNetTestHostCompatibility - - - \ No newline at end of file diff --git a/bff/performance/Bff.Benchmarks/Bff.Benchmarks.net9.0.v3.ncrunchproject b/bff/performance/Bff.Benchmarks/Bff.Benchmarks.net9.0.v3.ncrunchproject deleted file mode 100644 index 4b1d0cbb0..000000000 --- a/bff/performance/Bff.Benchmarks/Bff.Benchmarks.net9.0.v3.ncrunchproject +++ /dev/null @@ -1,7 +0,0 @@ - - - - AspNetTestHostCompatibility - - - \ No newline at end of file diff --git a/bff/src/Bff.Blazor.Client/Internals/FetchUserService.cs b/bff/src/Bff.Blazor.Client/Internals/FetchUserService.cs index 6bae70149..27bb2fc9c 100644 --- a/bff/src/Bff.Blazor.Client/Internals/FetchUserService.cs +++ b/bff/src/Bff.Blazor.Client/Internals/FetchUserService.cs @@ -5,6 +5,7 @@ using System.Net.Http.Json; using System.Security.Claims; using System.Text.Json; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; namespace Duende.Bff.Blazor.Client.Internals; @@ -34,9 +35,7 @@ internal class FetchUserService : IDisposable internal FetchUserService() { _client = new HttpClient(); -#pragma warning disable CA2000 // This is a test-only ctor, so we don't want to dispose the client here. - _logger = new Logger(new LoggerFactory()); -#pragma warning restore CA2000 + _logger = NullLogger.Instance; } public virtual async ValueTask FetchUserAsync() diff --git a/bff/src/Bff.EntityFramework/SessionDbContext.cs b/bff/src/Bff.EntityFramework/SessionDbContext.cs index d4d15ddfc..a509c9cc4 100644 --- a/bff/src/Bff.EntityFramework/SessionDbContext.cs +++ b/bff/src/Bff.EntityFramework/SessionDbContext.cs @@ -36,9 +36,12 @@ public class SessionDbContext : DbContext, ISessionDbContext /// Initializes a new instance of the class. /// /// + // TODO: address CS8618 +#pragma warning disable CS8618 // Non-nullable variable must contain a non-null value when exiting constructor. Consider adding the 'required' modifier declaring it as nullable. public SessionDbContext(DbContextOptions options) : base(options) { } +#pragma warning restore CS8618 /// /// DbSet for user sessions diff --git a/bff/templates/src/BffBlazorAutoRenderMode/BffBlazorAutoRenderMode/Program.cs b/bff/templates/src/BffBlazorAutoRenderMode/BffBlazorAutoRenderMode/Program.cs index ea5134217..3cdcc7604 100644 --- a/bff/templates/src/BffBlazorAutoRenderMode/BffBlazorAutoRenderMode/Program.cs +++ b/bff/templates/src/BffBlazorAutoRenderMode/BffBlazorAutoRenderMode/Program.cs @@ -1,6 +1,7 @@ using BffBlazorAutoRenderMode; using BffBlazorAutoRenderMode.Components; using Duende.Bff.Blazor; +using Microsoft.AspNetCore.DataProtection; var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -62,6 +63,11 @@ builder.Services.AddCascadingAuthenticationState(); builder.Services.AddAuthorization(); +// Add `.PersistKeysTo…()` and `.ProtectKeysWith…()` calls +// See more at https://docs.duendesoftware.com/general/data-protection +builder.Services.AddDataProtection() + .SetApplicationName("BFF"); + var app = builder.Build(); // Configure the HTTP request pipeline. diff --git a/bff/templates/src/BffLocalApi/HostingExtensions.cs b/bff/templates/src/BffLocalApi/HostingExtensions.cs index d3decc007..eb5f89996 100644 --- a/bff/templates/src/BffLocalApi/HostingExtensions.cs +++ b/bff/templates/src/BffLocalApi/HostingExtensions.cs @@ -1,3 +1,4 @@ +using Microsoft.AspNetCore.DataProtection; using Serilog; namespace BffLocalApi; @@ -49,6 +50,12 @@ internal static class HostingExtensions options.TokenValidationParameters.RoleClaimType = "role"; }); + + // Add `.PersistKeysTo…()` and `.ProtectKeysWith…()` calls + // See more at https://docs.duendesoftware.com/general/data-protection + _ = builder.Services.AddDataProtection() + .SetApplicationName("BFF"); + return builder.Build(); } diff --git a/bff/templates/src/BffRemoteApi/Program.cs b/bff/templates/src/BffRemoteApi/Program.cs index c34700d0d..22f99012b 100644 --- a/bff/templates/src/BffRemoteApi/Program.cs +++ b/bff/templates/src/BffRemoteApi/Program.cs @@ -1,5 +1,6 @@ using BffRemoteApi; using Duende.Bff.Yarp; +using Microsoft.AspNetCore.DataProtection; var builder = WebApplication.CreateBuilder(args); @@ -46,6 +47,10 @@ builder.Services.AddAuthentication(options => }; }); +// Add `.PersistKeysTo…()` and `.ProtectKeysWith…()` calls +// See more at https://docs.duendesoftware.com/general/data-protection +builder.Services.AddDataProtection() + .SetApplicationName("BFF"); var app = builder.Build(); diff --git a/bff/test/Bff.Tests/AssemblyInfo.cs b/bff/test/Bff.Tests/AssemblyInfo.cs deleted file mode 100644 index ea3e2a365..000000000 --- a/bff/test/Bff.Tests/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Duende Software. All rights reserved. -// See LICENSE in the project root for license information. - -[assembly: CaptureConsole] diff --git a/bff/test/Bff.Tests/Bff.Tests.net8.0.v3.ncrunchproject b/bff/test/Bff.Tests/Bff.Tests.net8.0.v3.ncrunchproject deleted file mode 100644 index 379f97e79..000000000 --- a/bff/test/Bff.Tests/Bff.Tests.net8.0.v3.ncrunchproject +++ /dev/null @@ -1,143 +0,0 @@ - - - True - - AspNetTestHostCompatibility - - - - Bff.Tests.Blazor.BffBlazorTests - - - Duende.Bff.Tests.Endpoints.RemoteEndpointTests - - - Duende.Bff.Tests.Endpoints.Management.UserEndpointTests - - - Duende.Bff.Tests.Endpoints.Management.ManagementBasePathTests - - - Duende.Bff.Tests.Endpoints.Management.LogoutEndpointTests - - - Duende.Bff.Tests.Endpoints.Management.LoginEndpointTests - - - Duende.Bff.Tests.Endpoints.LocalEndpointTests - - - Duende.Bff.Tests.Endpoints.DpopRemoteEndpointTests - - - Duende.Bff.Tests.Configuration.BffBuilderTests - - - Duende.Bff.Tests.BffWithoutExplicitFrontendTests - - - Duende.Bff.Tests.BffFrontendSigninTests - - - Duende.Bff.Tests.BffFrontendMatchingTests - - - Duende.Bff.Tests.BffFrontendIndexTests - - - Duende.Bff.EntityFramework.Tests.UserSessionStoreTests - - - Duende.Bff.Blazor.Client.UnitTests.ServiceCollectionExtensionsTests - - - Duende.Bff.Blazor.Client.UnitTests.FetchUserServiceTests - - - Duende.Bff.Blazor.Client.UnitTests.BffClientAuthenticationStateProviderTests - - - Duende.Bff.Blazor.Client.UnitTests.AntiForgeryHandlerTests - - - Duende.Bff.Tests.Endpoints.Management.LoginEndpointTestsCopy - - - Bff.Tests.Blazor.ServerSideTokenStoreTests - - - Duende.Bff.Tests.ConventionTests - - - Duende.Bff.Tests.Endpoints.DPoPTestsWithManualAuthentication - - - Duende.Bff.Tests.BffRemoteApiTests - - - Duende.Bff.Tests.Headers.ApiUseForwardedHeaders - - - Duende.Bff.Tests.Endpoints.Management.BackchannelLogoutEndpointTests - - - Duende.Bff.Tests.Endpoints.Management.BackchannelLogoutEndpointTests2 - - - Duende.Bff.Tests.TestInfra.TestInfraTests - - - Duende.Bff.Tests.SessionManagement.ServerSideTicketStoreTests - - - Duende.Bff.Tests.SessionManagement.RevokeRefreshTokenTests - - - Duende.Bff.Tests.SessionManagement.CookieSlidingTests - - - Duende.Bff.Tests.MultiFrontend.OriginTests - - - Duende.Bff.Tests.MultiFrontend.LocalFrontEndCacheTests - - - Duende.Bff.Tests.MultiFrontend.DefaultPathMapperTests - - - Duende.Bff.Tests.MultiFrontend.DefaultFrontendSelectorTests - - - Duende.Bff.Tests.IAccessTokenRetriever_Extensibility_tests - - - Duende.Bff.Tests.Headers.General - - - Duende.Bff.Tests.Headers.ApiAndBffUseForwardedHeaders - - - Duende.Bff.Tests.GenericHostTests - - - Duende.Bff.Tests.Endpoints.YarpTests - - - Duende.Bff.Tests.MultiFrontend.LocalFrontEndStoreTests - - - Bff.Tests.PublicApiVerificationTests.VerifyPublicApi_Bff_Yarp - - - Bff.Tests.PublicApiVerificationTests.VerifyPublicApi_Bff_EntityFramework - - - Bff.Tests.PublicApiVerificationTests.VerifyPublicApi_Bff_Blazor_Client - - - Bff.Tests.PublicApiVerificationTests.VerifyPublicApi_Bff_Blazor - - - - - \ No newline at end of file diff --git a/bff/test/Bff.Tests/Bff.Tests.net9.0.v3.ncrunchproject b/bff/test/Bff.Tests/Bff.Tests.net9.0.v3.ncrunchproject deleted file mode 100644 index 4b1d0cbb0..000000000 --- a/bff/test/Bff.Tests/Bff.Tests.net9.0.v3.ncrunchproject +++ /dev/null @@ -1,7 +0,0 @@ - - - - AspNetTestHostCompatibility - - - \ No newline at end of file diff --git a/bff/test/Hosts.Tests/AssemblyInfo.cs b/bff/test/Hosts.Tests/AssemblyInfo.cs deleted file mode 100644 index ea3e2a365..000000000 --- a/bff/test/Hosts.Tests/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Duende Software. All rights reserved. -// See LICENSE in the project root for license information. - -[assembly: CaptureConsole] diff --git a/bff/test/Hosts.Tests/Hosts.Tests.v3.ncrunchproject b/bff/test/Hosts.Tests/Hosts.Tests.v3.ncrunchproject deleted file mode 100644 index 6b3cda2a9..000000000 --- a/bff/test/Hosts.Tests/Hosts.Tests.v3.ncrunchproject +++ /dev/null @@ -1,7 +0,0 @@ - - - True - False - Debug_NCrunch - - \ No newline at end of file