diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-19 08:58:34 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-19 09:07:20 +0100 |
commit | fce7fe04eed39e23e76717085e92118e963def81 (patch) | |
tree | 767e5c92cbed548d2b5fb27ce1e6236da4ebdbcf /server/middlewares | |
parent | 4ddcb7c3bad4e98d05d25298f7f11353a639b360 (diff) | |
download | PeerTube-fce7fe04eed39e23e76717085e92118e963def81.tar.gz PeerTube-fce7fe04eed39e23e76717085e92118e963def81.tar.zst PeerTube-fce7fe04eed39e23e76717085e92118e963def81.zip |
Update server dependencies
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/oauth.ts | 8 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { logger } from '../helpers/logger' | ||
3 | import { Socket } from 'socket.io' | 2 | import { Socket } from 'socket.io' |
4 | import { getAccessToken } from '../lib/oauth-model' | ||
5 | import { oAuthServer } from '@server/lib/auth' | 3 | import { oAuthServer } from '@server/lib/auth' |
4 | import { logger } from '../helpers/logger' | ||
5 | import { getAccessToken } from '../lib/oauth-model' | ||
6 | 6 | ||
7 | function authenticate (req: express.Request, res: express.Response, next: express.NextFunction, authenticateInQuery = false) { | 7 | function 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 | ||
26 | function authenticateSocket (socket: Socket, next: (err?: any) => void) { | 26 | function 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 | }) |