Skip to content

Commit 271dfc4

Browse files
feat: use the cookie store configuration for setting redirectTarget cookie (#3010)
1 parent 9061e3c commit 271dfc4

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

packages/ember-simple-auth/src/session-stores/cookie.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,14 @@ export default class CookieStore extends BaseStore {
370370
}
371371

372372
setRedirectTarget(url: string) {
373-
this.get('_cookies').write(`${this.cookieName}-redirectTarget`, url, {
374-
path: '/',
373+
let cookieOptions = {
374+
domain: this.get('cookieDomain'),
375+
path: this.get('cookiePath'),
375376
secure: this._secureCookies(),
376-
});
377+
sameSite: this.get('sameSite'),
378+
partitioned: this.get('partitioned'),
379+
} as WriteOptions;
380+
this.get('_cookies').write(`${this.cookieName}-redirectTarget`, url, cookieOptions);
377381
}
378382

379383
getRedirectTarget() {

packages/test-esa/tests/unit/services/session-test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ module('SessionService', function (hooks) {
244244

245245
assert.ok(
246246
writeCookieStub.calledWith(cookieName, transition.intent.url, {
247+
domain: null,
248+
partitioned: null,
247249
path: '/',
250+
sameSite: null,
248251
secure: true,
249252
})
250253
);
@@ -256,7 +259,10 @@ module('SessionService', function (hooks) {
256259

257260
assert.ok(
258261
writeCookieStub.calledWith(cookieName, redirectTarget, {
262+
domain: null,
263+
partitioned: null,
259264
path: '/',
265+
sameSite: null,
260266
secure: true,
261267
})
262268
);

0 commit comments

Comments
 (0)