Skip to content

Commit

Permalink
Merge pull request #355 from mcnielsen/v1
Browse files Browse the repository at this point in the history
ENG-53866 - Handle "Fortra_required" Error during Authentication
  • Loading branch information
BryanTabarez authored Feb 20, 2024
2 parents 811f19d + b1f5cac commit 0fbf545
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@al/core",
"version": "1.2.22",
"version": "1.2.23",
"description": "Node Enterprise Packages for Alert Logic (NEPAL) Core Library",
"main": "./dist/index.cjs.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/aims-client/aims-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ export class AIMSClientInstance implements AlValidationSchemaProvider {
service_name: this.serviceName,
version: this.serviceVersion,
path: `/${accountId}/mapping`
})
});
}

/**
Expand Down
12 changes: 12 additions & 0 deletions src/session/utilities/al-authentication.utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export enum AlAuthenticationResult {
MFAVerificationRequired = 'mfa_verification_required',
TOSAcceptanceRequired = 'eula_acceptance_required',
TOSReacceptanceRequired = 'eula_reacceptance_required',
FortraIdPRequired = 'fidp_required',
InvalidCredentials = 'failed'
}

Expand Down Expand Up @@ -332,6 +333,9 @@ export class AlAuthenticationUtility {
this.state.sessionToken = error.headers['x-aims-session-token'];
this.state.deferralTOSPeriodEnd = getJsonPath<string>( error, 'data.tos_deferral_period_end', null );
return true;
} else if ( this.requiresFortraIdP( error ) ) {
this.state.result = AlAuthenticationResult.FortraIdPRequired;
return true;
} else if( error.status === 400) {
this.state.result = AlAuthenticationResult.AccountLocked;
return true;
Expand Down Expand Up @@ -389,4 +393,12 @@ export class AlAuthenticationUtility {
&& response.data.error === 'reaccept_tos_required';
}

protected requiresFortraIdP( response:AxiosResponse<any> ):boolean {
return response.status === 401
&& typeof( response.data ) === 'object'
&& response.data !== null
&& 'error' in response.data
&& response.data.error === 'fortra_required';
}

}

0 comments on commit 0fbf545

Please sign in to comment.