Skip to content

Commit

Permalink
Merge branch 'duosecurity:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
bewong2 authored Mar 18, 2024
2 parents 89eb289 + 06b5a0c commit 88871a3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions duo_client/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
'email_activity_notification_enabled': <bool:can users get activity notifications via email>,
'push_activity_notification_enabled': <bool:can users get activity notifications via Duo Mobile>,
'unenrolled_user_lockout_threshold': <int:days until a user will be locked out due to being unenrolled>,
'enrollment_universal_prompt_enabled': <bool:will email enrollment use Universal Prompt experience>,
}
Expand Down Expand Up @@ -1989,6 +1990,7 @@ def update_settings(self,
email_activity_notification_enabled=None,
push_activity_notification_enabled=None,
unenrolled_user_lockout_threshold=None,
enrollment_universal_prompt_enabled=None,
):
"""
Update settings.
Expand Down Expand Up @@ -2031,6 +2033,7 @@ def update_settings(self,
email_activity_notification_enabled = True|False|None
push_activity_notification_enabled = True|False|None
unenrolled_user_lockout_threshold = <int:number of days>|0|None
enrollment_universal_prompt_enabled = True|False|None
Returns updated settings object.
Expand Down Expand Up @@ -2118,6 +2121,10 @@ def update_settings(self,
params['unenrolled_user_lockout_threshold'] = str(
unenrolled_user_lockout_threshold
)
if enrollment_universal_prompt_enabled is not None:
params['enrollment_universal_prompt_enabled'] = (
'1' if enrollment_universal_prompt_enabled else '0'
)

if not params:
raise TypeError("No settings were provided")
Expand Down
8 changes: 7 additions & 1 deletion duo_client/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def preauth(self,
username=None,
user_id=None,
ipaddr=None,
client_supports_verified_push=None,
trusted_device_token=None):
"""
Determine if and with what factors a user may authenticate or enroll.
Expand All @@ -100,6 +101,8 @@ def preauth(self,
params['user_id'] = user_id
if ipaddr is not None:
params['ipaddr'] = ipaddr
if client_supports_verified_push is not None:
params['client_supports_verified_push'] = client_supports_verified_push
if trusted_device_token is not None:
params['trusted_device_token'] = trusted_device_token
response = self.json_api_call('POST',
Expand All @@ -117,7 +120,8 @@ def auth(self,
display_username=None,
pushinfo=None,
device=None,
passcode=None):
passcode=None,
txid=None):
"""
Perform second-factor authentication for a user.
Expand Down Expand Up @@ -156,6 +160,8 @@ def auth(self,
params['device'] = device
if passcode is not None:
params['passcode'] = passcode
if txid is not None:
params['txid'] = txid
response = self.json_api_call('POST',
'/auth/v2/auth',
params)
Expand Down
2 changes: 2 additions & 0 deletions tests/admin/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_update_settings(self):
email_activity_notification_enabled=True,
push_activity_notification_enabled=True,
unenrolled_user_lockout_threshold=100,
enrollment_universal_prompt_enabled=True,
)
response = response[0]
self.assertEqual(response['method'], 'POST')
Expand Down Expand Up @@ -85,4 +86,5 @@ def test_update_settings(self):
'email_activity_notification_enabled': '1',
'push_activity_notification_enabled': '1',
'unenrolled_user_lockout_threshold': '100',
'enrollment_universal_prompt_enabled': '1',
})

0 comments on commit 88871a3

Please sign in to comment.