From e9ffe95ef8ba19b7d881305b24d2e0b36d119960 Mon Sep 17 00:00:00 2001 From: James Ruiz Date: Thu, 9 Feb 2023 15:38:05 -0800 Subject: [PATCH 1/2] Fix flow to prompt user to pick valid role --- src/lib/extaws.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/extaws.ts b/src/lib/extaws.ts index 29eaaac..ddf06cd 100644 --- a/src/lib/extaws.ts +++ b/src/lib/extaws.ts @@ -168,7 +168,6 @@ export class ExtAws { * @returns The selected role */ private static async selectRole(roles: STSAssumeRole[]): Promise { - if (roles.length === 1) return roles[0] const roleList = roles.map( (role, index) => { const roleName = role.role.split('/') return { name: roleName[roleName.length -1], value: index} @@ -176,7 +175,7 @@ export class ExtAws { const { role } = await ExtAws.inquire<{role: number}>([{ name: 'role', type: 'list', - message: 'Please select the role to assume', + message: 'Available roles:', choices: roleList, }]) return roles[role] @@ -425,8 +424,7 @@ export class ExtAws { if (searchResult !== undefined) { userRole = searchResult } else { - spinner.text = `Provided role(${props.role}) was not found. Please select from roles found` - spinner.stop() + spinner.fail(`You do not have authorization to assume role (${props.role}). Please select from roles found`) userRole = await ExtAws.selectRole(roles) spinner.start('Logging in...') } From 41ea4d65aa790ae14db241331628c9aca86b8957 Mon Sep 17 00:00:00 2001 From: James Ruiz Date: Fri, 10 Feb 2023 11:02:26 -0800 Subject: [PATCH 2/2] Bumping patch version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f3f6bb9..8a1db4b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "extaws", - "version": "0.0.13", + "version": "0.0.14", "description": "Extend Okta Aws Authentication", "main": "dist/index.js", "files": [