diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-28 15:32:57 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-28 15:32:57 +0200 |
commit | 031bbcd25d0e34668b429590d9c32a1be7b7d4e4 (patch) | |
tree | a02bc0a529a479e0483aea6492df2bdb8b2c2a0a /server | |
parent | 4fae2b1f300c1f027629569817262f60873a663a (diff) | |
download | PeerTube-031bbcd25d0e34668b429590d9c32a1be7b7d4e4.tar.gz PeerTube-031bbcd25d0e34668b429590d9c32a1be7b7d4e4.tar.zst PeerTube-031bbcd25d0e34668b429590d9c32a1be7b7d4e4.zip |
Upgrade oauth2-server
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/auth/oauth-model.ts | 2 | ||||
-rw-r--r-- | server/lib/auth/oauth.ts | 7 |
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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { AccessDeniedError } from 'oauth2-server' | 2 | import { AccessDeniedError } from '@node-oauth/oauth2-server' |
3 | import { PluginManager } from '@server/lib/plugins/plugin-manager' | 3 | import { PluginManager } from '@server/lib/plugins/plugin-manager' |
4 | import { ActorModel } from '@server/models/actor/actor' | 4 | import { ActorModel } from '@server/models/actor/actor' |
5 | import { MOAuthClient } from '@server/types/models' | 5 | import { 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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { | 2 | import 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' |
11 | import { randomBytesPromise } from '@server/helpers/core-utils' | 11 | import { randomBytesPromise } from '@server/helpers/core-utils' |
12 | import { MOAuthClient } from '@server/types/models' | 12 | import { MOAuthClient } from '@server/types/models' |
13 | import { sha1 } from '@shared/extra-utils' | 13 | import { 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 | 22 | const oAuthServer = new OAuth2Server({ | |
23 | const 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 | ||