server/mw/oauth: res.loc.auth to true upon auth
Setting res.locals.authenticated explicity to true makes it's more clear whether the req is authenticated when using optionalAuthenticate middlware.
This commit is contained in:
parent
f17faefb30
commit
2805cb7cb6
2 changed files with 3 additions and 1 deletions
|
@ -20,6 +20,8 @@ function authenticate (req: express.Request, res: express.Response, next: expres
|
|||
.end()
|
||||
}
|
||||
|
||||
res.locals.authenticated = true
|
||||
|
||||
return next()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ describe('Test plugin helpers', function () {
|
|||
statusCodeExpected: 200
|
||||
})
|
||||
|
||||
expect(res.body.isAuthenticated).to.equal(undefined)
|
||||
expect(res.body.isAuthenticated).to.equal(true)
|
||||
|
||||
const secRes = await makeGetRequest({
|
||||
url: server.url,
|
||||
|
|
Loading…
Reference in a new issue