Skip to content

Commit e2dd296

Browse files
authored
Set SameSiteMode for cookies in authentication tests (#25281)
1 parent 098be5f commit e2dd296

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Startup.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Microsoft.AspNetCore.Authentication;
44
using Microsoft.AspNetCore.Builder;
55
using Microsoft.AspNetCore.Hosting;
6+
using Microsoft.AspNetCore.Http;
67
using Microsoft.AspNetCore.Identity;
78
using Microsoft.EntityFrameworkCore;
89
using Microsoft.Extensions.Configuration;
@@ -57,6 +58,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
5758
app.UseWebAssemblyDebugging();
5859
}
5960

61+
app.UseCookiePolicy(new CookiePolicyOptions
62+
{
63+
MinimumSameSitePolicy = SameSiteMode.Lax
64+
});
65+
6066
app.UseBlazorFrameworkFiles();
6167
app.UseStaticFiles();
6268

src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Wasm.Authentication.Server.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010

1111
<ItemGroup>
1212
<Reference Include="Microsoft.AspNetCore" />
13+
<Reference Include="Microsoft.AspNetCore.CookiePolicy" />
1314
<Reference Include="Microsoft.AspNetCore.Diagnostics" />
1415
<Reference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" />
1516
<Reference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" />
1617
<Reference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
18+
<Reference Include="Microsoft.AspNetCore.Authentication.Cookies" />
1719
<Reference Include="Microsoft.EntityFrameworkCore.Design" />
1820
<Reference Include="Microsoft.AspNetCore.Identity.UI" />
1921
<Reference Include="Microsoft.EntityFrameworkCore.Relational" />

0 commit comments

Comments
 (0)