I've got an ASP.NET Core 6 MVC Razor pages application using Microsoft Identity for AzureAD integrated authentication running on an Azure Linux AppService plan (with forced HTTPS).
The authentication integration works like a charm. Couldn't be happier.
But in my logs I see warnings like so:
The cookie '".AspNetCore.Correlation.[...]"' has set 'SameSite=None' and must also set 'Secure'.
(and for the .AspNetCore.OpenIdConnect.Nonce cookie).
I've tried adding a cookie policy:
app.UseCookiePolicy(new CookiePolicyOptions
{
HttpOnly = Microsoft.AspNetCore.CookiePolicy.HttpOnlyPolicy.Always,
MinimumSameSitePolicy = Microsoft.AspNetCore.Http.SameSiteMode.None,
Secure = Microsoft.AspNetCore.Http.CookieSecurePolicy.Always
});
But no joy.
I tried that code positioned right after "var app = builder.Build();" and right after "app.UseAuthentication(); app.UseAuthorization();" (just before app.MapRazorPages().RequireAuthorization("MyRoleId")).
Any thoughts on how to get these cookies set as secure?