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

filter webauthn by authenticatorName #292

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions gimme_aws_creds/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ def okta(self):
if self.conf_dict.get('preferred_mfa_type'):
okta.set_preferred_mfa_type(self.conf_dict['preferred_mfa_type'])

if self.conf_dict.get('authenticator_name'):
okta.set_authenticator_name(self.conf_dict['authenticator_name'])

if self.config.mfa_code is not None:
okta.set_mfa_code(self.config.mfa_code)
elif self.conf_dict.get('okta_mfa_code'):
Expand Down Expand Up @@ -613,6 +616,7 @@ def aws_results(self):
'links': {'appLink': self.config.app_url}
}
aws_results.append(new_app_entry)
self.ui.info("Authentication Success!")

# Use the gimme_creds_lambda service
else:
Expand Down
9 changes: 9 additions & 0 deletions gimme_aws_creds/okta.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(self, gac_ui, okta_org_url, verify_ssl_certs=True, device_token=Non
self._username = None
self._password = None
self._preferred_mfa_type = None
self._authenticator_name = None
self._mfa_code = None
self._remember_device = None

Expand Down Expand Up @@ -102,6 +103,9 @@ def set_password(self, password):
def set_preferred_mfa_type(self, preferred_mfa_type):
self._preferred_mfa_type = preferred_mfa_type

def set_authenticator_name(self, authenticator_name):
self._authenticator_name = authenticator_name

def set_mfa_code(self, mfa_code):
self._mfa_code = mfa_code

Expand Down Expand Up @@ -778,6 +782,11 @@ def _choose_factor(self, factors):
factors.append(passcode)
if self._preferred_mfa_type is not None:
preferred_factors = list(filter(lambda item: item['factorType'] == self._preferred_mfa_type, factors))

# if you have more than one webauthn registered
if self._authenticator_name is not None:
preferred_factors=list(filter(lambda item: item['profile']['authenticatorName'] == 'Authenticator', preferred_factors))
bwynsm marked this conversation as resolved.
Show resolved Hide resolved

# If the preferred factor isn't in the list of available factors, we'll let the user know before
# prompting to select another.
if not preferred_factors:
Expand Down