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

add method to update Passport configuration via the AdminAPI #279

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

kmahan-duo
Copy link
Contributor

@kmahan-duo kmahan-duo commented Oct 28, 2024

Description

Create a method to call the API endpoint that creates or updates a customer's Passport configuration https://duo.com/docs/adminapi#passport

Motivation and Context

Make it easier for tools and automations to update the Passport configuration

How Has This Been Tested?

Added a unit test to ensure arguments are passed correctly.

❯ nose2
........................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 216 tests in 0.140s

OK

Tested locally against a development server:

>>> client = duo_client.admin.Admin(ikey=..., skey=..., host="api-duo1.duo.test", ca_certs="DISABLE")
>>> client.get_passport_config()
{'disabled_groups': [], 'enabled_groups': [], 'enabled_status': 'enabled'}
>>> client.update_passport_config(enabled_status="enabled-for-groups", enabled_groups=["DGC4RP5EMSL1M5EX0321", "DG3MVJRRM9PFDGG3P2CJ"])
''
>>> client.get_passport_config()
{'disabled_groups': [], 'enabled_groups': [{'group_id': 'DGC4RP5EMSL1M5EX0321', 'group_name': 'group_foo'}, {'group_id': 'DG3MVJRRM9PFDGG3P2CJ', 'group_name': 'group_bar'}], 'enabled_status': 'enabled-for-groups'}
image
>>> client.update_passport_config(enabled_status="enabled-with-exceptions", disabled_groups=["DGC4RP5EMSL1M5EX0321", "DG3MVJRRM9PFDGG3P2CJ"])
''
>>> client.get_passport_config()
{'disabled_groups': [{'group_id': 'DGC4RP5EMSL1M5EX0321', 'group_name': 'group_foo'}, {'group_id': 'DG3MVJRRM9PFDGG3P2CJ', 'group_name': 'group_bar'}], 'enabled_groups': [], 'enabled_status': 'enabled-with-exceptions'}
image

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@kmahan-duo kmahan-duo force-pushed the kara-update-passport branch from 76a8266 to 7b797c0 Compare October 28, 2024 15:54
@kmahan-duo kmahan-duo force-pushed the kara-update-passport branch from 7b797c0 to a6318d8 Compare October 29, 2024 13:48
@AaronAtDuo AaronAtDuo merged commit 5ed6201 into duosecurity:master Oct 29, 2024
5 checks passed
@kmahan-duo kmahan-duo deleted the kara-update-passport branch October 29, 2024 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants