Skip to content

Commit

Permalink
bau-reauth-request-change: Refactor CheckReauthUser service to includ…
Browse files Browse the repository at this point in the history
…e the user sub in request
  • Loading branch information
ayoshebby committed Mar 4, 2024
1 parent 9d25946 commit 4e9fe1b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export function checkReauthUsersService(
const checkReauthUsers = async function (
sessionId: string,
emailAddress: string,
sub: string,
sourceIp: string,
clientSessionId: string,
persistentSessionId: string
Expand All @@ -33,7 +34,7 @@ export function checkReauthUsersService(

const response = await axios.client.post<DefaultApiResponse>(
API_ENDPOINTS.CHECK_REAUTH_USER,
{ email: lowerCaseEmail },
{ email: lowerCaseEmail, rpPairwiseId: sub },
config
);

Expand Down
1 change: 1 addition & 0 deletions src/components/check-reauth-users/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface CheckReauthServiceInterface {
checkReauthUsers: (
sessionId: string,
email: string,
sub: string,
sourceIp: string,
clientSessionId: string,
persistentSessionId: string
Expand Down
5 changes: 3 additions & 2 deletions src/components/enter-email/enter-email-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ export function enterEmailPost(
const email = req.body.email;
const { sessionId, clientSessionId, persistentSessionId } = res.locals;
req.session.user.email = email.toLowerCase();
const isReAuthenticationRequired = req.session.user.reauthenticate;
const sub = req.session.user.reauthenticate;

if (supportReauthentication() && isReAuthenticationRequired) {
if (supportReauthentication() && sub) {
const checkReauth = await checkReauthService.checkReauthUsers(
sessionId,
email,
sub,
req.ip,
clientSessionId,
persistentSessionId
Expand Down

0 comments on commit 4e9fe1b

Please sign in to comment.