Skip to content

Commit

Permalink
the antiforgery token is different
Browse files Browse the repository at this point in the history
  • Loading branch information
carlsixsmith-moj committed Aug 15, 2024
1 parent 17de237 commit 7fa0e43
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Server.UI/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,17 @@ public static WebApplicationBuilder AddServerUi(this WebApplicationBuilder build
var services = builder.Services;
var config = builder.Configuration;
var environment = builder.Environment;



CookieSecurePolicy policy = CookieSecurePolicy.SameAsRequest;
if(config["IdentitySettings:SecureCookies"] is not null && config["IdentitySettings:SecureCookies"]!.Equals("True", StringComparison.CurrentCultureIgnoreCase))
{
policy = CookieSecurePolicy.Always;
}

services.AddAntiforgery(options =>
{
options.Cookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
options.Cookie.SecurePolicy = policy;
});

services.AddRazorComponents().AddInteractiveServerComponents();
Expand Down

0 comments on commit 7fa0e43

Please sign in to comment.