-
Notifications
You must be signed in to change notification settings - Fork 224
feat: enable prompt if role not provided #165
Conversation
Hello this was a change that we needed and wanted to submit an upstream PR to see if this would be a useful change for everyone. the new exec flow would look something like this:
This is a change from:
In both cases I'm using the default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sensible, except for the bonus refactoring :P
lib/util/prompt.go
Outdated
@@ -1,4 +1,4 @@ | |||
package lib | |||
package util |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This refactoring seems orthogonal to the problem at hand? And while I appreciate the effort, it'd be best to leave it out, for compatibility's sake.
We really should refactor all this stuff into an internal
package so we don't have to worry about compatibility.
lib/saml/roles.go
Outdated
} | ||
return roleList.Roles[factorIdx].Role, roleList.Roles[factorIdx].Principal, nil | ||
} | ||
func (resp *Response) GetAssumableRolesFromSAML() (AssumableRoles, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't worry about doing this refactor here; it makes the actual purpose of the PR a little unclear.
Love this feature, if it can be implemented. ❤️ |
4c4e199
to
7778499
Compare
Fixed up the commit to remove the extra refactoring. Let me know what you think. |
7778499
to
e1e4a7d
Compare
@nickatsegment Mind merging this? Or are you waiting on more approvals? 🙂 |
Thanks for pinging me. I do need a second pair of eyes. Looks harmless but this codebase is getting hairy and hard to follow. |
@switj I merged your other PR first because I feel more sure about it. Please rebase :) |
If the `role_arn` is provided, attempt to assume that role. No change to current behaviour. If `role_arn` is empty or not present in the profile and there is more than one role then display the full list of roles the user can assume and prompt them to choose the role to assume. The choice will be sticky for the rest of the session for that profile. Whne the session ends they will be prompted again to choose a role.
e1e4a7d
to
373d137
Compare
@nickatsegment rebase done. thanks for merging the other PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@nickatsegment @Fauzyy @switj Thanks so much for the quick response! What's usually the process for getting a new version into homebrew? Do we update this? https://github.com/Homebrew/homebrew-core/blob/master/Formula/aws-okta.rb |
Usually we just cut a release and a magical fairy does the rest :D I bet they'd accept a PR from you I'll cut a release now |
If the
role_arn
is provided, attempt to assume that role. No change tocurrent behaviour.
If
role_arn
is empty or not present in the profile and there is more than onerole then display the full list of roles the user can assume and prompt
them to choose the role to assume. The choice will be sticky for the
rest of the session for that profile. Whne the session ends they will be
prompted again to choose a role.