ActivityPub-federated video streaming platform using P2P directly in your web browser
Upgrade oauth2-server
Chocobozzz031bbcd25d0e
diff --git a/package.json b/package.jsonindex 93fa4b04ad..6a5bcf75c7 100644--- a/package.json+++ b/package.json@@ -84,6 +84,7 @@"@aws-sdk/lib-storage": "^3.72.0","@aws-sdk/node-http-handler": "^3.82.0","@babel/parser": "7.17.8",+ "@node-oauth/oauth2-server": "^4.2.0","@peertube/feed": "^5.0.1","@peertube/http-signature": "^1.6.0","@uploadx/core": "^5.1.2",@@ -132,7 +133,6 @@"multer": "^1.4.5-lts.1","node-media-server": "^2.1.4","nodemailer": "^6.0.0",- "oauth2-server": "3.1.1","parse-torrent": "^9.1.0","password-generator": "^2.0.2","pem": "^1.12.3",diff --git a/server/lib/auth/oauth-model.ts b/server/lib/auth/oauth-model.tsindex 910fdeec10..d9cf328272 100644--- a/server/lib/auth/oauth-model.ts+++ b/server/lib/auth/oauth-model.ts@@ -1,5 +1,5 @@import express from 'express'-import { AccessDeniedError } from 'oauth2-server'+import { AccessDeniedError } from '@node-oauth/oauth2-server'import { PluginManager } from '@server/lib/plugins/plugin-manager'import { ActorModel } from '@server/models/actor/actor'import { MOAuthClient } from '@server/types/models'diff --git a/server/lib/auth/oauth.ts b/server/lib/auth/oauth.tsindex 2bf7a63617..fa18873158 100644--- a/server/lib/auth/oauth.ts+++ b/server/lib/auth/oauth.ts@@ -1,5 +1,5 @@import express from 'express'-import {+import OAuth2Server, {InvalidClientError,InvalidGrantError,InvalidRequestError,@@ -7,7 +7,7 @@ import {Response,UnauthorizedClientError,UnsupportedGrantTypeError-} from 'oauth2-server'+} from '@node-oauth/oauth2-server'import { randomBytesPromise } from '@server/helpers/core-utils'import { MOAuthClient } from '@server/types/models'import { sha1 } from '@shared/extra-utils'@@ -19,8 +19,7 @@ import { BypassLogin, getClient, getRefreshToken, getUser, revokeToken, saveToke* Reimplement some functions of OAuth2Server to inject external auth methods**/--const oAuthServer = new (require('oauth2-server'))({+const oAuthServer = new OAuth2Server({accessTokenLifetime: OAUTH_LIFETIME.ACCESS_TOKEN,refreshTokenLifetime: OAUTH_LIFETIME.REFRESH_TOKEN,diff --git a/yarn.lock b/yarn.lockindex a0519d54ed..4d9b5b4bd7 100644--- a/yarn.lock+++ b/yarn.lock@@ -1569,6 +1569,22 @@resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-2.0.2.tgz#baea7764b1adf201ce4a792fe971fd7211dad2e4"integrity sha512-fpnI00dt+yO1cKx9qBXelKhPBdEgvc8ZPav1+0r09j0woYQU2N79w/jcGawSY5UGlgQ3vjaJsFHnGbGvvqdLzg==+"@node-oauth/formats@^1.0.0":+ version "1.0.0"+ resolved "https://registry.yarnpkg.com/@node-oauth/formats/-/formats-1.0.0.tgz#6525478802180199ecf6ea3208fc5e1b683031be"+ integrity sha512-DwSbLtdC8zC5B5gTJkFzJj5s9vr9SGzOgQvV9nH7tUVuMSScg0EswAczhjIapOmH3Y8AyP7C4Jv7b8+QJObWZA==++"@node-oauth/oauth2-server@^4.2.0":+ version "4.2.0"+ resolved "https://registry.yarnpkg.com/@node-oauth/oauth2-server/-/oauth2-server-4.2.0.tgz#6817b137018f8fceafa8fc7bddf66766251b3116"+ integrity sha512-4nMcdCp3JNhhJAIjYou49QNcFZZdZ//kC7igrCw1Etlqhdz38hgLEUDXFpyGYQszVK9fg5HRIgR9e6mFaxiUEw==+ dependencies:+ "@node-oauth/formats" "^1.0.0"+ basic-auth "2.0.1"+ bluebird "3.7.2"+ promisify-any "2.0.1"+ type-is "1.6.18"+"@nodelib/[email protected]":version "2.1.5"resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"@@ -5889,11 +5905,6 @@ lodash.merge@^4.6.2:resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==- version "4.17.19"- resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"- integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==-lodash@>=4.17.13, lodash@^4.17.10, lodash@^4.17.20, lodash@^4.17.21:version "4.17.21"resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"@@ -6610,18 +6621,6 @@ nth-check@^2.0.1:dependencies:boolbase "^1.0.0"- version "3.1.1"- resolved "https://registry.yarnpkg.com/oauth2-server/-/oauth2-server-3.1.1.tgz#be291da840a307a50368736ab766bd68f2eeb3a9"- integrity sha512-4dv+fE9hrK+xTaCygOLh/kQeFzbFr7UqSyHvBDbrQq8Hg52sAkV2vTsyH3Z42hoeaKpbhM7udhL8Y4GYbl6TGQ==- dependencies:- basic-auth "2.0.1"- bluebird "3.7.2"- lodash "4.17.19"- promisify-any "2.0.1"- statuses "1.5.0"- type-is "1.6.18"-object-assign@^4, object-assign@^4.1.1:version "4.1.1"resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"@@ -8180,16 +8179,16 @@ standard-as-callback@^2.1.0:resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.1.0.tgz#8953fc05359868a77b5b9739a665c5977bb7df45"integrity sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==[email protected], "statuses@>= 1.5.0 < 2":- version "1.5.0"- resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"- integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==-version "2.0.1"resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63"integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==+"statuses@>= 1.5.0 < 2":+ version "1.5.0"+ resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"+ integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==+version "3.0.0"resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-3.0.0.tgz#22b0a2850cdf6503e73085da1fc7b7d0c2122f2f"