Browse Source

refactor: removed/fixed some comments, removed oauth dependency

Kristian Vos 1 month ago
parent
commit
585db39fd6
4 changed files with 2 additions and 24 deletions
  1. 1 1
      backend/logic/app.js
  2. 1 11
      backend/logic/users.js
  3. 0 11
      backend/package-lock.json
  4. 0 1
      backend/package.json

+ 1 - 1
backend/logic/app.js

@@ -65,7 +65,7 @@ class _AppModule extends CoreClass {
 				const params = [
 					`client_id=${config.get("apis.oidc.client_id")}`,
 					`redirect_uri=${UsersModule.oidcRedirectUri}`,
-					`scope=basic openid`, // TODO check if openid is necessary for us
+					`scope=basic openid`,
 					`response_type=code`
 				].join("&");
 				return res.redirect(`${UsersModule.oidcAuthorizationEndpoint}?${params}`);

+ 1 - 11
backend/logic/users.js

@@ -251,16 +251,6 @@ class _UsersModule extends CoreClass {
 		if (!userInfoResponse.data.preferred_username) throw new Error("Something went wrong, no preferred_username.");
 		// TODO verify sub from userinfo and token response, see 5.3.2 https://openid.net/specs/openid-connect-core-1_0.html
 
-		// TODO we don't use linking for OIDC currently, so remove this or utilize it in some other way if needed
-		// If we specified a state in the first step when we redirected the user to OIDC, it was to link a
-		// OIDC account to an existing Musare account, so continue with a job specifically for linking the account
-		// if (state)
-		// 	return UsersModule.runJob(
-		// 		"OIDC_AUTHORIZE_CALLBACK_LINK",
-		// 		{ state, sub: userInfoResponse.data.sub, accessToken },
-		// 		this
-		// 	);
-
 		const user = await UsersModule.userModel.findOne({ "services.oidc.sub": userInfoResponse.data.sub });
 		let userId;
 		if (user) {
@@ -294,7 +284,7 @@ class _UsersModule extends CoreClass {
 	}
 
 	/**
-	 * Handles registering the user in the OIDC login/register/link callback/process
+	 * Handles registering the user in the OIDC login/register callback/process
 	 * @param {object} payload - object that contains the payload
 	 * @param {string} payload.userInfoResponse - data we got from the OIDC user info API endpoint
 	 * @param {string} payload.accessToken - access token for the OIDC user

+ 0 - 11
backend/package-lock.json

@@ -22,7 +22,6 @@
         "moment": "^2.30.1",
         "mongoose": "^6.13.3",
         "nodemailer": "^6.9.16",
-        "oauth": "^0.10.0",
         "redis": "^4.7.0",
         "retry-axios": "^3.1.3",
         "sha256": "^0.2.0",
@@ -3892,11 +3891,6 @@
         "set-blocking": "^2.0.0"
       }
     },
-    "node_modules/oauth": {
-      "version": "0.10.0",
-      "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.10.0.tgz",
-      "integrity": "sha512-1orQ9MT1vHFGQxhuy7E/0gECD3fd2fCC+PIX+/jgmU/gI3EpRocXtmtvxCO5x3WZ443FLTLFWNDjl5MPJf9u+Q=="
-    },
     "node_modules/object-assign": {
       "version": "4.1.1",
       "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -8133,11 +8127,6 @@
         "set-blocking": "^2.0.0"
       }
     },
-    "oauth": {
-      "version": "0.10.0",
-      "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.10.0.tgz",
-      "integrity": "sha512-1orQ9MT1vHFGQxhuy7E/0gECD3fd2fCC+PIX+/jgmU/gI3EpRocXtmtvxCO5x3WZ443FLTLFWNDjl5MPJf9u+Q=="
-    },
     "object-assign": {
       "version": "4.1.1",
       "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",

+ 0 - 1
backend/package.json

@@ -28,7 +28,6 @@
     "moment": "^2.30.1",
     "mongoose": "^6.13.3",
     "nodemailer": "^6.9.16",
-    "oauth": "^0.10.0",
     "redis": "^4.7.0",
     "retry-axios": "^3.1.3",
     "sha256": "^0.2.0",