Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "extaws",
"version": "0.0.13",
"version": "0.0.14",
"description": "Extend Okta Aws Authentication",
"main": "dist/index.js",
"files": [
Expand Down
6 changes: 2 additions & 4 deletions src/lib/extaws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,14 @@ export class ExtAws {
* @returns The selected role
*/
private static async selectRole(roles: STSAssumeRole[]): Promise<STSAssumeRole> {
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}
})
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]
Expand Down Expand Up @@ -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...')
}
Expand Down