Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
set cookies to IsEssential #2554
Browse files Browse the repository at this point in the history
  • Loading branch information
brockallen committed Oct 3, 2018
1 parent e52b862 commit 77860f3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void Configure(string name, CookieAuthenticationOptions options)
options.SlidingExpiration = _idsrv.Authentication.CookieSlidingExpiration;
options.ExpireTimeSpan = _idsrv.Authentication.CookieLifetime;
options.Cookie.Name = IdentityServerConstants.DefaultCookieAuthenticationScheme;
options.Cookie.IsEssential = true;
options.Cookie.SameSite = SameSiteMode.None;

options.LoginPath = ExtractLocalUrl(_idsrv.UserInteraction.LoginUrl);
Expand All @@ -39,6 +40,7 @@ public void Configure(string name, CookieAuthenticationOptions options)
if (name == IdentityServerConstants.ExternalCookieAuthenticationScheme)
{
options.Cookie.Name = IdentityServerConstants.ExternalCookieAuthenticationScheme;
options.Cookie.IsEssential = true;
// https://github.com/IdentityServer/IdentityServer4/issues/2595
// need to set None because iOS 12 safari considers the POST back to the client from the
// IdP as not safe, so cookies issued from response (with lax) then should not be honored.
Expand Down
6 changes: 4 additions & 2 deletions src/Infrastructure/MessageCookie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ public void Write(string id, Message<TModel> message)
{
HttpOnly = true,
Secure = Secure,
Path = CookiePath
Path = CookiePath,
IsEssential = true,
// don't need to set same-site since cookie is expected to be sent
// to only another page in this host.
});
Expand Down Expand Up @@ -138,7 +139,8 @@ private void ClearByCookieName(string name)
Expires = new DateTime(2000, 1, 1),
HttpOnly = true,
Secure = Secure,
Path = CookiePath
Path = CookiePath,
IsEssential = true,
});
}

Expand Down
1 change: 1 addition & 0 deletions src/Services/Default/DefaultUserSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ private CookieOptions CreateSessionIdCookieOptions()
HttpOnly = false,
Secure = secure,
Path = path,
IsEssential = true,
SameSite = SameSiteMode.None
};

Expand Down

0 comments on commit 77860f3

Please sign in to comment.