aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-19 08:58:34 +0100
committerChocobozzz <me@florianbigard.com>2020-11-19 09:07:20 +0100
commitfce7fe04eed39e23e76717085e92118e963def81 (patch)
tree767e5c92cbed548d2b5fb27ce1e6236da4ebdbcf /server/middlewares
parent4ddcb7c3bad4e98d05d25298f7f11353a639b360 (diff)
downloadPeerTube-fce7fe04eed39e23e76717085e92118e963def81.tar.gz
PeerTube-fce7fe04eed39e23e76717085e92118e963def81.tar.zst
PeerTube-fce7fe04eed39e23e76717085e92118e963def81.zip
Update server dependencies
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/oauth.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.ts
index b1149174b..bd60a3639 100644
--- a/server/middlewares/oauth.ts
+++ b/server/middlewares/oauth.ts
@@ -1,8 +1,8 @@
1import * as express from 'express' 1import * as express from 'express'
2import { logger } from '../helpers/logger'
3import { Socket } from 'socket.io' 2import { Socket } from 'socket.io'
4import { getAccessToken } from '../lib/oauth-model'
5import { oAuthServer } from '@server/lib/auth' 3import { oAuthServer } from '@server/lib/auth'
4import { logger } from '../helpers/logger'
5import { getAccessToken } from '../lib/oauth-model'
6 6
7function authenticate (req: express.Request, res: express.Response, next: express.NextFunction, authenticateInQuery = false) { 7function authenticate (req: express.Request, res: express.Response, next: express.NextFunction, authenticateInQuery = false) {
8 const options = authenticateInQuery ? { allowBearerTokensInQueryString: true } : {} 8 const options = authenticateInQuery ? { allowBearerTokensInQueryString: true } : {}
@@ -24,7 +24,7 @@ function authenticate (req: express.Request, res: express.Response, next: expres
24} 24}
25 25
26function authenticateSocket (socket: Socket, next: (err?: any) => void) { 26function authenticateSocket (socket: Socket, next: (err?: any) => void) {
27 const accessToken = socket.handshake.query.accessToken 27 const accessToken = socket.handshake.query['accessToken']
28 28
29 logger.debug('Checking socket access token %s.', accessToken) 29 logger.debug('Checking socket access token %s.', accessToken)
30 30
@@ -38,7 +38,7 @@ function authenticateSocket (socket: Socket, next: (err?: any) => void) {
38 return next(new Error('Invalid access token.')) 38 return next(new Error('Invalid access token.'))
39 } 39 }
40 40
41 socket.handshake.query.user = tokenDB.User 41 socket.handshake.query['user'] = tokenDB.User
42 42
43 return next() 43 return next()
44 }) 44 })