Set SameSiteMode for cookies in authentication tests (#25281)

This commit is contained in:
Safia Abdalla 2020-08-26 19:22:34 +00:00 committed by GitHub
parent 098be5f5ee
commit e2dd2969b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -3,6 +3,7 @@ using System.Linq;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
@ -57,6 +58,11 @@ namespace Wasm.Authentication.Server
app.UseWebAssemblyDebugging();
}
app.UseCookiePolicy(new CookiePolicyOptions
{
MinimumSameSitePolicy = SameSiteMode.Lax
});
app.UseBlazorFrameworkFiles();
app.UseStaticFiles();

View File

@ -10,10 +10,12 @@
<ItemGroup>
<Reference Include="Microsoft.AspNetCore" />
<Reference Include="Microsoft.AspNetCore.CookiePolicy" />
<Reference Include="Microsoft.AspNetCore.Diagnostics" />
<Reference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" />
<Reference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" />
<Reference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<Reference Include="Microsoft.AspNetCore.Authentication.Cookies" />
<Reference Include="Microsoft.EntityFrameworkCore.Design" />
<Reference Include="Microsoft.AspNetCore.Identity.UI" />
<Reference Include="Microsoft.EntityFrameworkCore.Relational" />