Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

choose MFA option if there is only one #288

Merged
merged 1 commit into from
May 18, 2023

Conversation

DannyDaoBoYang
Copy link
Contributor

@DannyDaoBoYang DannyDaoBoYang commented May 18, 2023

Why

  • Skip MFAoption selection if only 1 option is available.

@github-actions
Copy link
Contributor

PR #289 created to format .cs files.

Comment on lines 131 to 133
if( ( mfaOptions[i].Provider == DefautMFAProvider ) && ( mfaOptions[i].Name == DefaultMFAmethod ) ) {
return i;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if( ( mfaOptions[i].Provider == DefautMFAProvider ) && ( mfaOptions[i].Name == DefaultMFAmethod ) ) {
return i;
}
return Array.IndexOf(mfaOptions, mfaOptions.FirstOrDefault(option => option.Provider == DefautMFAProvider && option.Name == DefaultMFAmethod))

LINQ is pretty op once you start using it a bit. Not saying you should change what you have though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, will use that

@github-actions
Copy link
Contributor

PR #290 created to format .cs files.

)
);
}
private static int PromptMfa( MfaOption[] mfaOptions, string DefautMFAProvider, string DefaultMFAmethod ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private static int PromptMfa( MfaOption[] mfaOptions, string DefautMFAProvider, string DefaultMFAmethod ) {
private static int PromptMfa( MfaOption[] mfaOptions, string defaultMfaProvider, string defaultMfaMethod ) {

Looks like the other areas of code have Mfa instead of MFA all caps

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also want to use camelCase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure will change that

@github-actions
Copy link
Contributor

PR #291 created to format .cs files.

@@ -55,6 +55,9 @@
var profileOption = new Option<string>(
name: "--profile",
description: "aws profile name" );
var MFAOption = new Option<string>(
name: "--dftMFA",
description: "the defaultMFA in the provider_method format (eg. OKTA_question)" );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the implementation in this PR and Okta's doc on MFA API, I have doubt on how worthwhile this "default MFA option" feature really is.
The description here is cryptic, and hard to make it understandable too. Even if users understand this, it's still hard for users to know what to enter here (or in the config). Who would've thought of entering GOOGLE_token:software:totp for example?

Selecting the only MFA option when appropriate is a nice-to-have and an easy win, but I'm not convinced we should implement default MFA selection in the config or on the command line.

Copy link
Member

@boarnoah boarnoah May 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, the way Okta exposes factors, how the names are written is really no good.
Since the MFA case is already an edge case for Okta authn the value is further lessened.

@DannyDaoBoYang DannyDaoBoYang force-pushed the Select_and_Set_MFA_In_Config branch from ea5de90 to 244c3e5 Compare May 18, 2023 19:33
@github-actions github-actions bot added size/S A small PR. and removed size/M A medium-sized PR. labels May 18, 2023
@DannyDaoBoYang
Copy link
Contributor Author

Updated branch. So the only change here will be to choose MFA option if there is only one

@cfbao
Copy link
Member

cfbao commented May 18, 2023

Updated branch. So the only change here will be to choose MFA option if there is only one

Thanks! Can you update the PR title & description accordingly too?

@DannyDaoBoYang DannyDaoBoYang changed the title Select and set mfa in config choose MFA option if there is only one May 18, 2023
@DannyDaoBoYang
Copy link
Contributor Author

Updated branch. So the only change here will be to choose MFA option if there is only one

Thanks! Can you update the PR title & description accordingly too?

Yes. Updated.

@DannyDaoBoYang DannyDaoBoYang merged commit 9955efb into main May 18, 2023
@DannyDaoBoYang DannyDaoBoYang deleted the Select_and_Set_MFA_In_Config branch May 18, 2023 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants