Skip to content

Commit 38b129c

Browse files
committed
Made the logout route remove the user
1 parent e2f407c commit 38b129c

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

lib/api/authn/webid-oidc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ function initialize (app, argv) {
5050
.then(webId => {
5151
if (webId) {
5252
req.session.userId = webId
53-
} else {
54-
req.session.userId = null
5553
}
5654

5755
next()

lib/create-app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ function initWebId (argv, app, ldp) {
236236
// Ensure this modified session is not saved
237237
req.session.save = (done) => done()
238238
}
239+
if (isLogoutRequest(req)) {
240+
delete req.session.userId
241+
}
239242
next()
240243
})
241244

test/integration/authentication-oidc-with-strict-origins-turned-off-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ describe('Authentication API (OIDC) - With strict origins turned off', () => {
223223
})
224224
})
225225

226-
it('should return a 401 even with a cookie', () => expect(response).to.have.property('status', 401))
226+
it('should return a 200', () => expect(response).to.have.property('status', 200))
227227
})
228228
describe('and our origin', () => {
229229
before(done => {
@@ -236,7 +236,7 @@ describe('Authentication API (OIDC) - With strict origins turned off', () => {
236236
})
237237
})
238238

239-
it('should return a 401 even with a cookie', () => expect(response).to.have.property('status', 401))
239+
it('should return a 200', () => expect(response).to.have.property('status', 200))
240240
})
241241
describe('and trusted origin', () => {
242242
before(done => {

0 commit comments

Comments
 (0)