Skip to content

Commit 4aa0907

Browse files
captainsafiadougbu
authored andcommitted
Set SameSiteMode for cookies in authentication tests (#25281)
1 parent d422d09 commit 4aa0907

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
@@ -11,10 +11,12 @@
1111

1212
<ItemGroup>
1313
<Reference Include="Microsoft.AspNetCore" />
14+
<Reference Include="Microsoft.AspNetCore.CookiePolicy" />
1415
<Reference Include="Microsoft.AspNetCore.Diagnostics" />
1516
<Reference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" />
1617
<Reference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" />
1718
<Reference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
19+
<Reference Include="Microsoft.AspNetCore.Authentication.Cookies" />
1820
<Reference Include="Microsoft.AspNetCore.Identity.UI" />
1921
<Reference Include="Microsoft.EntityFrameworkCore.Relational" />
2022
<Reference Include="Microsoft.EntityFrameworkCore.SQLite" />

0 commit comments

Comments
 (0)