From 1163f360b7199b5cbbc51c7de44e82cb7b1e5f19 Mon Sep 17 00:00:00 2001 From: Vlad Rudych Date: Sat, 5 Oct 2019 22:31:20 +0300 Subject: [PATCH] Added cookie policy support When the cookie policy is used, a contest policy check can remove Saml2.Session cookie. In this case, "IsEssential = true" should be set to bypass the contest policy check. --- .../Saml2.Authentication.Core/Configuration/Saml2Options.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Saml2.Authentication.Core/Configuration/Saml2Options.cs b/Source/Saml2.Authentication.Core/Configuration/Saml2Options.cs index def6a20..6ba07ed 100644 --- a/Source/Saml2.Authentication.Core/Configuration/Saml2Options.cs +++ b/Source/Saml2.Authentication.Core/Configuration/Saml2Options.cs @@ -22,7 +22,8 @@ public Saml2Options() Name = $"{Saml2Defaults.SessionKeyPrefix}.{Guid.NewGuid():N}", HttpOnly = true, SameSite = SameSiteMode.None, - SecurePolicy = CookieSecurePolicy.SameAsRequest + SecurePolicy = CookieSecurePolicy.SameAsRequest, + IsEssential = true }; } @@ -68,4 +69,4 @@ public override CookieOptions Build(HttpContext context, DateTimeOffset expiresF return cookieOptions; } } -} \ No newline at end of file +}