From 84436d8dd4e93fb772ba00d530c5882752dac633 Mon Sep 17 00:00:00 2001 From: Anass Bouassaba Date: Wed, 2 Oct 2024 21:24:05 +0200 Subject: [PATCH] fix(idp): add invalid_credentials error + fix typos (#344) * fix(idp): add invalid_credentials error * chore(idp): regenerate docs --- idp/.prettierignore | 3 ++- idp/bun.lockb | Bin 150874 -> 140058 bytes idp/package.json | 4 +--- idp/src/app.ts | 9 ++++++--- idp/src/infra/error.ts | 11 +++++++---- idp/src/token/service.ts | 8 ++++---- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/idp/.prettierignore b/idp/.prettierignore index d72cb639f..dafa71525 100644 --- a/idp/.prettierignore +++ b/idp/.prettierignore @@ -1,2 +1,3 @@ dist -templates/**/*.hbs \ No newline at end of file +docs +templates/**/*.hbs diff --git a/idp/bun.lockb b/idp/bun.lockb index a90cb9665d766ba7a77ec383a4b48be397c1467f..d961e6c2b91d297fba90527ce0419f4e30c0f77e 100755 GIT binary patch delta 11164 zcmeI2d301&p2y#Pq(~|YNl3^p2`IaSEI>hGN+SCvNDNuXY6wXnn6MgxPzeeuO%%9r zE-*TP?E=~YvKUCK?cS)MAhOyh&UBB6IwNWerVY&Z`|6e!r_-F7b9&C1Ke#8K`rhC7 zF7MWR_r2V@RcAKYH@)MxIg?-6vMD1EG?^< zdoP>LEuTNXs(dc1msZa+K7|*6^5am}Q#wAKZ5V-wYb*NCUsPK@uX3vN4@h(sO*IUE z*l(a(7<65(VMIaqAm%70Lpwn?<{3r;v}eA%UM!S{*{^j8%6YgIQ1-KMnqhQ?rlLJH ztiat*Bl>6glkh_gLpBE_yIP9yF5&Hfa)?dEhS43m7|OPr;d3kjrH0WH>Zx}caV+8s zC5F)rdKh{WbT^d#^fGt5t%z}~1~J`zCNII~d(J|PF^4vkRhCxIG7MutieZGKK-T&7 z9=8@p4MMOC%JV;SUimyUGzM1~Ml|AYp*+fIC`TW!^8tO zpQac_5_oc4z?VMn4z zj0>mlFrrcJqt!ahZUr)JuG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CXtdMNVprHa06VR-2xcovGET z5j438ajA$3Ra7n_JT@{XIXf#MB^^T~Cq0IOD>Y3_{++Mq_PI7YAr}8P1U=Gc?s|h5 z@+a@&@{h9N{|}wmb35-MK6X%yax$nEJPjno5!QTSy*<2>)u)Gm%cr!;Q;aZH)c2K_ znXt)8JU*6I^!Qk+p}8V6b5-e)+3|Snl*r_S5n4$SukGUPYRl^-WS5gDIpZ2%-|6q} zaQM4ohK0hV<=<}rpT8?q(t3?*!m6Pio~=#IN=Qr168WRNeFJ^v{?ej^e|k=-;9Y9V zD@b_ANeo5HJA8dFdD#h*oRlKKi*8I~L0Z1caU%&*e!9BC)?6&(6}IK$92FkC_=}UGSnTwi1!#HqdWs|b{{S=Lli&aV diff --git a/idp/package.json b/idp/package.json index 0a0825031..af155e63e 100644 --- a/idp/package.json +++ b/idp/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "start": "bun src/app.ts", - "dev": "nodemon --exec ts-node -r tsconfig-paths/register src/app.ts", + "dev": "bun src/app.ts", "tsc": "tsc --noEmit", "format": "prettier --write .", "swagger-autogen": "bun ./swagger.js", @@ -50,10 +50,8 @@ "@types/uuid": "9.0.8", "eslint": "9.3.0", "globals": "15.3.0", - "nodemon": "3.1.0", "prettier": "3.2.5", "swagger-autogen": "2.23.7", - "ts-node": "10.9.2", "tsconfig-paths": "4.2.0", "typescript": "5.4.5", "typescript-eslint": "7.9.0" diff --git a/idp/src/app.ts b/idp/src/app.ts index e35d6ce85..fde11b28c 100644 --- a/idp/src/app.ts +++ b/idp/src/app.ts @@ -13,11 +13,11 @@ import cors from 'cors' import express from 'express' import logger from 'morgan' import passport from 'passport' -import { Strategy as JwtStrategy, ExtractJwt } from 'passport-jwt' +import { ExtractJwt, Strategy as JwtStrategy } from 'passport-jwt' import accountRouter from '@/account/router' import { getConfig } from '@/config/config' import healthRouter from '@/health/router' -import { errorHandler } from '@/infra/error' +import { ErrorCode, errorHandler, newError, newResponse } from '@/infra/error' import tokenRouter from '@/token/router' import userRepo from '@/user/repo' import userRouter from '@/user/router' @@ -46,7 +46,10 @@ passport.use( const user = await userRepo.findByID(payload.sub) return done(null, user) } catch { - return done(null, false) + return done( + newResponse(newError({ code: ErrorCode.InvalidCredentials })), + false, + ) } }, ), diff --git a/idp/src/infra/error.ts b/idp/src/infra/error.ts index a3b61461b..3b99ccdfb 100644 --- a/idp/src/infra/error.ts +++ b/idp/src/infra/error.ts @@ -17,7 +17,8 @@ export enum ErrorCode { InvalidUsernameOrPassword = 'invalid_username_or_password', InvalidPassword = 'invalid_password', InvalidJwt = 'invalid_jwt', - EmailNotConfimed = 'email_not_confirmed', + InvalidCredentials = 'invalid_credentials', + EmailNotConfirmed = 'email_not_confirmed', RefreshTokenExpired = 'refresh_token_expired', InvalidRequest = 'invalid_request', UnsupportedGrantType = 'unsupported_grant_type', @@ -37,7 +38,8 @@ const statuses: { [key: string]: number } = { [ErrorCode.InvalidUsernameOrPassword]: 401, [ErrorCode.InvalidPassword]: 401, [ErrorCode.InvalidJwt]: 401, - [ErrorCode.EmailNotConfimed]: 401, + [ErrorCode.InvalidCredentials]: 401, + [ErrorCode.EmailNotConfirmed]: 401, [ErrorCode.RefreshTokenExpired]: 401, [ErrorCode.InvalidRequest]: 400, [ErrorCode.UnsupportedGrantType]: 400, @@ -51,9 +53,10 @@ const statuses: { [key: string]: number } = { const userMessages: { [key: string]: string } = { [ErrorCode.UsernameUnavailable]: 'Email belongs to an existing user.', - [ErrorCode.EmailNotConfimed]: 'Email not confirmed.', + [ErrorCode.EmailNotConfirmed]: 'Email not confirmed.', [ErrorCode.InvalidPassword]: 'Invalid password.', [ErrorCode.InvalidUsernameOrPassword]: 'Invalid username or password.', + [ErrorCode.InvalidCredentials]: 'Invalid credentials.', [ErrorCode.UserSuspended]: 'User suspended.', [ErrorCode.MissingPermission]: 'You are not an console', [ErrorCode.OrphanError]: 'You cannot suspend last console', @@ -91,7 +94,7 @@ export function newError(options: ErrorOptions): ErrorData { const userMessage = options.userMessage || userMessages[options.code] || - 'Oops! something went wrong' + 'Oops! something went wrong.' return { code: options.code, status: statuses[options.code], diff --git a/idp/src/token/service.ts b/idp/src/token/service.ts index 447f40024..dd395e9c5 100644 --- a/idp/src/token/service.ts +++ b/idp/src/token/service.ts @@ -34,7 +34,7 @@ export type TokenExchangeOptions = { } export async function exchange(options: TokenExchangeOptions): Promise { - validateParemeters(options) + validateParameters(options) // https://datatracker.ietf.org/doc/html/rfc6749#section-4.3 if (options.grant_type === 'password') { let user: User @@ -44,7 +44,7 @@ export async function exchange(options: TokenExchangeOptions): Promise { throw newError({ code: ErrorCode.InvalidUsernameOrPassword }) } if (!user.isEmailConfirmed) { - throw newError({ code: ErrorCode.EmailNotConfimed }) + throw newError({ code: ErrorCode.EmailNotConfirmed }) } if (!user.isActive) { throw newError({ code: ErrorCode.UserSuspended }) @@ -64,7 +64,7 @@ export async function exchange(options: TokenExchangeOptions): Promise { throw newError({ code: ErrorCode.InvalidUsernameOrPassword }) } if (!user.isEmailConfirmed) { - throw newError({ code: ErrorCode.EmailNotConfimed }) + throw newError({ code: ErrorCode.EmailNotConfirmed }) } if (new Date() >= new Date(user.refreshTokenExpiry)) { throw newError({ code: ErrorCode.RefreshTokenExpired }) @@ -78,7 +78,7 @@ export const checkAdmin = (jwt) => { throw newError({ code: ErrorCode.MissingPermission }) } -function validateParemeters(options: TokenExchangeOptions) { +function validateParameters(options: TokenExchangeOptions) { if (!options.grant_type) { throw newError({ code: ErrorCode.InvalidRequest,