-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clear __csrf cookie after logout (#927)
- Loading branch information
1 parent
19cc257
commit 5c27f00
Showing
2 changed files
with
11 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,7 +195,7 @@ describe('api: /sessions', () => { | |
.then((token) => service.delete(`/v1/key/${token}/sessions/${token}`) | ||
.expect(403))))); | ||
|
||
it('should clear the cookie if successful for the current session', testService((service) => | ||
it('should clear cookies if successful for the current session', testService((service) => | ||
service.post('/v1/sessions') | ||
.send({ email: '[email protected]', password: 'alice' }) | ||
.expect(200) | ||
|
@@ -206,12 +206,14 @@ describe('api: /sessions', () => { | |
.set('Authorization', 'Bearer ' + token) | ||
.expect(200) | ||
.then(({ headers }) => { | ||
const cookie = headers['set-cookie'][0]; | ||
cookie.should.match(/__Host-session=null/); | ||
headers['set-cookie'].should.eql([ | ||
'__Host-session=null; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; Secure; SameSite=Strict', | ||
'__csrf=null; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; SameSite=Strict' | ||
]); | ||
}); | ||
}))); | ||
|
||
it('should not clear the cookie if using some other session', testService((service) => | ||
it('should not clear cookies if using some other session', testService((service) => | ||
service.post('/v1/sessions') | ||
.send({ email: '[email protected]', password: 'alice' }) | ||
.expect(200) | ||
|