Skip to content

Commit 5a79289

Browse files
committed
Fixed jaliss#616: Add cookie SameSite
1 parent f31d52b commit 5a79289

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

module-code/app/securesocial/core/authenticator/CookieAuthenticator.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2013-2014 Jorge Aliss (jaliss at gmail dot com) - twitter: @jaliss
2+
* Copyright 2013-2018 Jorge Aliss (jaliss at gmail dot com) - twitter: @jaliss
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -166,7 +166,8 @@ case class CookieConfig(
166166
httpOnly: Boolean,
167167
idleTimeoutInMinutes: Int,
168168
absoluteTimeoutInMinutes: Int,
169-
makeTransient: Boolean) {
169+
makeTransient: Boolean,
170+
sameSite: Option[String] = Option(Cookie.SameSite.Lax.value)) {
170171
def absoluteTimeoutInSeconds: Int = absoluteTimeoutInMinutes * 60
171172

172173
def toCookieWithId(id: String): Cookie = Cookie(
@@ -176,7 +177,8 @@ case class CookieConfig(
176177
path,
177178
domain,
178179
secure,
179-
httpOnly)
180+
httpOnly,
181+
sameSite.flatMap(Cookie.SameSite.parse))
180182

181183
def discardingCookie: DiscardingCookie =
182184
DiscardingCookie(name, path, domain, secure)

module-code/conf/reference.conf

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ securesocial {
3636
idleTimeoutInMinutes = 30
3737
absoluteTimeoutInMinutes = 720
3838
makeTransient = true
39+
sameSite = lax
3940
}
4041

4142
userpass {

0 commit comments

Comments
 (0)