fix(xo-server): better token check on HTTP request

It now checks that the user associated with the authentication token really exists.

This fixes xo-web infinite refresh when the token stored in cookies belongs to a missing user.
This commit is contained in:
Julien Fontanet 2023-06-17 16:22:56 +02:00 committed by Florent BEAUCHAMP
parent 04d70e9aa8
commit ef2bd2b59d
3 changed files with 7 additions and 1 deletions

View File

@ -42,6 +42,7 @@
- @xen-orchestra/fs patch
- @vates/node-vsphere-soap major
- @xen-orchestra/vmware-explorer patch
- xo-server patch
- xo-server-auth-oidc minor
- xo-web minor

View File

@ -267,7 +267,8 @@ export default class {
}
async isValidAuthenticationToken(id) {
return (await this._getAuthenticationToken(id)) !== undefined
const token = await this._getAuthenticationToken(id)
return token !== undefined && (await this._app.doesUserExist(token.user_id))
}
async updateAuthenticationToken(properties, { description }) {

View File

@ -119,6 +119,10 @@ export default class {
})
}
doesUserExist(id) {
return this._users.exists(id)
}
async updateUser(
id,
{