aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/auth
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-06-28 15:32:57 +0200
committerChocobozzz <me@florianbigard.com>2022-06-28 15:32:57 +0200
commit031bbcd25d0e34668b429590d9c32a1be7b7d4e4 (patch)
treea02bc0a529a479e0483aea6492df2bdb8b2c2a0a /server/lib/auth
parent4fae2b1f300c1f027629569817262f60873a663a (diff)
downloadPeerTube-031bbcd25d0e34668b429590d9c32a1be7b7d4e4.tar.gz
PeerTube-031bbcd25d0e34668b429590d9c32a1be7b7d4e4.tar.zst
PeerTube-031bbcd25d0e34668b429590d9c32a1be7b7d4e4.zip
Upgrade oauth2-server
Diffstat (limited to 'server/lib/auth')
-rw-r--r--server/lib/auth/oauth-model.ts2
-rw-r--r--server/lib/auth/oauth.ts7
2 files changed, 4 insertions, 5 deletions
diff --git a/server/lib/auth/oauth-model.ts b/server/lib/auth/oauth-model.ts
index 910fdeec1..d9cf32827 100644
--- a/server/lib/auth/oauth-model.ts
+++ b/server/lib/auth/oauth-model.ts
@@ -1,5 +1,5 @@
1import express from 'express' 1import express from 'express'
2import { AccessDeniedError } from 'oauth2-server' 2import { AccessDeniedError } from '@node-oauth/oauth2-server'
3import { PluginManager } from '@server/lib/plugins/plugin-manager' 3import { PluginManager } from '@server/lib/plugins/plugin-manager'
4import { ActorModel } from '@server/models/actor/actor' 4import { ActorModel } from '@server/models/actor/actor'
5import { MOAuthClient } from '@server/types/models' 5import { MOAuthClient } from '@server/types/models'
diff --git a/server/lib/auth/oauth.ts b/server/lib/auth/oauth.ts
index 2bf7a6361..fa1887315 100644
--- a/server/lib/auth/oauth.ts
+++ b/server/lib/auth/oauth.ts
@@ -1,5 +1,5 @@
1import express from 'express' 1import express from 'express'
2import { 2import OAuth2Server, {
3 InvalidClientError, 3 InvalidClientError,
4 InvalidGrantError, 4 InvalidGrantError,
5 InvalidRequestError, 5 InvalidRequestError,
@@ -7,7 +7,7 @@ import {
7 Response, 7 Response,
8 UnauthorizedClientError, 8 UnauthorizedClientError,
9 UnsupportedGrantTypeError 9 UnsupportedGrantTypeError
10} from 'oauth2-server' 10} from '@node-oauth/oauth2-server'
11import { randomBytesPromise } from '@server/helpers/core-utils' 11import { randomBytesPromise } from '@server/helpers/core-utils'
12import { MOAuthClient } from '@server/types/models' 12import { MOAuthClient } from '@server/types/models'
13import { sha1 } from '@shared/extra-utils' 13import { sha1 } from '@shared/extra-utils'
@@ -19,8 +19,7 @@ import { BypassLogin, getClient, getRefreshToken, getUser, revokeToken, saveToke
19 * Reimplement some functions of OAuth2Server to inject external auth methods 19 * Reimplement some functions of OAuth2Server to inject external auth methods
20 * 20 *
21 */ 21 */
22 22const oAuthServer = new OAuth2Server({
23const oAuthServer = new (require('oauth2-server'))({
24 accessTokenLifetime: OAUTH_LIFETIME.ACCESS_TOKEN, 23 accessTokenLifetime: OAUTH_LIFETIME.ACCESS_TOKEN,
25 refreshTokenLifetime: OAUTH_LIFETIME.REFRESH_TOKEN, 24 refreshTokenLifetime: OAUTH_LIFETIME.REFRESH_TOKEN,
26 25