Skip to content

Commit 556c56d

Browse files
authored
fix(authentication): properly setup the session cookie to restore authentication on remote environments (#433)
1 parent 95a30ed commit 556c56d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/controllers/forest_liana/authentication_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def authentication_callback
6969
httponly: true,
7070
secure: true,
7171
expires: ForestLiana::Token.expiration_in_days,
72-
samesite: 'none',
72+
same_site: :None,
7373
path: '/'
7474
},
7575
)
@@ -104,7 +104,7 @@ def logout
104104
httponly: true,
105105
secure: true,
106106
expires: Time.at(0),
107-
samesite: 'none',
107+
same_site: :None,
108108
path: '/'
109109
},
110110
)

spec/requests/authentications_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262
it "should return a valid authentication token" do
6363
session_cookie = response.headers['set-cookie']
64-
expect(session_cookie).to match(/^forest_session_token=[^;]+; path=\/; expires=[^;]+; secure; HttpOnly$/)
64+
expect(session_cookie).to match(/^forest_session_token=[^;]+; path=\/; expires=[^;]+; secure; HttpOnly; SameSite=None$/)
6565

6666
token = session_cookie.match(/^forest_session_token=([^;]+);/)[1]
6767
decoded = JWT.decode(token, ForestLiana.auth_secret, true, { algorithm: 'HS256' })[0]
@@ -100,7 +100,7 @@
100100

101101
it "should invalidate token from browser" do
102102
invalidated_session_cookie = response.headers['set-cookie']
103-
expect(invalidated_session_cookie).to match(/^forest_session_token=[^;]+; path=\/; expires=Thu, 01 Jan 1970 00:00:00 GMT; secure; HttpOnly$/)
103+
expect(invalidated_session_cookie).to match(/^forest_session_token=[^;]+; path=\/; expires=Thu, 01 Jan 1970 00:00:00 GMT; secure; HttpOnly; SameSite=None$/)
104104
end
105105
end
106106
end

0 commit comments

Comments
 (0)