Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 17bb340

Browse files
Merge pull request #30 from helloextend/bugfix/DEVOPS-476-fix-cli-login-to-throw-error
[DEVOPS-476] Fix flow to prompt user to pick valid role
2 parents 073114a + 41ea4d6 commit 17bb340

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "extaws",
3-
"version": "0.0.13",
3+
"version": "0.0.14",
44
"description": "Extend Okta Aws Authentication",
55
"main": "dist/index.js",
66
"files": [

src/lib/extaws.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,14 @@ export class ExtAws {
168168
* @returns The selected role
169169
*/
170170
private static async selectRole(roles: STSAssumeRole[]): Promise<STSAssumeRole> {
171-
if (roles.length === 1) return roles[0]
172171
const roleList = roles.map( (role, index) => {
173172
const roleName = role.role.split('/')
174173
return { name: roleName[roleName.length -1], value: index}
175174
})
176175
const { role } = await ExtAws.inquire<{role: number}>([{
177176
name: 'role',
178177
type: 'list',
179-
message: 'Please select the role to assume',
178+
message: 'Available roles:',
180179
choices: roleList,
181180
}])
182181
return roles[role]
@@ -425,8 +424,7 @@ export class ExtAws {
425424
if (searchResult !== undefined) {
426425
userRole = searchResult
427426
} else {
428-
spinner.text = `Provided role(${props.role}) was not found. Please select from roles found`
429-
spinner.stop()
427+
spinner.fail(`You do not have authorization to assume role (${props.role}). Please select from roles found`)
430428
userRole = await ExtAws.selectRole(roles)
431429
spinner.start('Logging in...')
432430
}

0 commit comments

Comments
 (0)