diff --git a/CHANGELOG.md b/CHANGELOG.md index c24713f4a..c6e19afb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Validation for customerID due to email rectification ## [2.172.0] - 2024-10-10 diff --git a/node/dataSources/identity.ts b/node/dataSources/identity.ts index b9cd4c5ab..0f42e1f8c 100644 --- a/node/dataSources/identity.ts +++ b/node/dataSources/identity.ts @@ -10,6 +10,7 @@ export interface DefaultUser { export interface User extends DefaultUser { id: string user: string + customerId: string account: string audience: string } diff --git a/node/directives/withCurrentProfile.ts b/node/directives/withCurrentProfile.ts index b9ccc522b..57b801c43 100644 --- a/node/directives/withCurrentProfile.ts +++ b/node/directives/withCurrentProfile.ts @@ -261,9 +261,10 @@ async function checkUserAccount( !( tokenUser.account === account && (isUserCallCenterOperator || - tokenUser.user.toLowerCase() === currentProfile?.email.toLowerCase()) + tokenUser.user.toLowerCase() === currentProfile?.email.toLowerCase() || + tokenUser.customerId === currentProfile?.userId) ) ) { - throw new AuthenticationError('') + throw new AuthenticationError('Information conflict in tokenUser') } }