From 02efc278fc879e5e1dce7b58d876bb99e825e0d3 Mon Sep 17 00:00:00 2001 From: Michael Yochpaz <8832013+MichaelYochpaz@users.noreply.github.com> Date: Thu, 12 Jan 2023 13:48:07 +0200 Subject: [PATCH] Add Stored Credentials Support to Okta (#23749) --- Packs/Okta/.pack-ignore | 4 +- Packs/Okta/Integrations/Okta_IAM/Okta_IAM.py | 13 +- Packs/Okta/Integrations/Okta_IAM/Okta_IAM.yml | 113 +++++++----------- Packs/Okta/Integrations/Okta_v2/Okta_v2.py | 10 +- Packs/Okta/Integrations/Okta_v2/Okta_v2.yml | 27 ++--- Packs/Okta/ReleaseNotes/3_1_2.md | 8 ++ Packs/Okta/pack_metadata.json | 2 +- 7 files changed, 77 insertions(+), 100 deletions(-) create mode 100644 Packs/Okta/ReleaseNotes/3_1_2.md diff --git a/Packs/Okta/.pack-ignore b/Packs/Okta/.pack-ignore index aa638d751b36..71b79b6d7678 100644 --- a/Packs/Okta/.pack-ignore +++ b/Packs/Okta/.pack-ignore @@ -2,10 +2,10 @@ ignore=auto-test [file:Okta_IAM.yml] -ignore=IN135,BA108,BA109,IN145 +ignore=IN135,BA108,BA109 [file:Okta_v2.yml] -ignore=BA108,BA109,IN145 +ignore=BA108,BA109 [file:README.md] ignore=RM104,RM106 diff --git a/Packs/Okta/Integrations/Okta_IAM/Okta_IAM.py b/Packs/Okta/Integrations/Okta_IAM/Okta_IAM.py index d8e53a5b8410..dc8a52f59247 100644 --- a/Packs/Okta/Integrations/Okta_IAM/Okta_IAM.py +++ b/Packs/Okta/Integrations/Okta_IAM/Okta_IAM.py @@ -1,14 +1,11 @@ import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 -# noqa: F401 -# noqa: F401 -# noqa: F401 -# noqa: F401 +import urllib3 # Disable insecure warnings -requests.packages.urllib3.disable_warnings() +urllib3.disable_warnings() '''CONSTANTS''' @@ -918,7 +915,11 @@ def main(): user_profile = None params = demisto.params() base_url = urljoin(params['url'].strip('/'), '/api/v1/') - token = params.get('apitoken') + token = params.get('credentials', {}).get('password', '') or params.get('apitoken', '') + + if not token: + raise ValueError('Missing API token.') + mapper_in = params.get('mapper-in') mapper_out = params.get('mapper-out') verify_certificate = not params.get('insecure', False) diff --git a/Packs/Okta/Integrations/Okta_IAM/Okta_IAM.yml b/Packs/Okta/Integrations/Okta_IAM/Okta_IAM.yml index 29b5e3e32521..0144f3d65ad9 100644 --- a/Packs/Okta/Integrations/Okta_IAM/Okta_IAM.yml +++ b/Packs/Okta/Integrations/Okta_IAM/Okta_IAM.yml @@ -7,10 +7,14 @@ configuration: name: url required: true type: 0 -- display: API Token (see Detailed Instructions) +- name: credentials + type: 9 + displaypassword: API Token (see detailed instructions) + hiddenusername: true +- display: API Token (See detailed instructions) name: apitoken - required: true type: 4 + hidden: true - display: Trust any certificate (not secure) name: insecure required: false @@ -49,52 +53,46 @@ configuration: name: mapper-in required: true type: 0 -- defaultvalue: User Profile - Okta (Outgoing) +- defaultvalue: 'User Profile - Okta (Outgoing)' display: Outgoing Mapper name: mapper-out required: true type: 0 -- defaultvalue: '50' - display: Fetch limit (recommended value is less than 200) +- display: Fetch limit (recommended value is less than 200) name: max_fetch required: false type: 0 + defaultvalue: '50' - display: Fetch incidents name: isFetch required: false type: 8 -- defaultvalue: '1' - display: Incidents Fetch Interval +- display: Incidents Fetch Interval name: incidentFetchInterval required: false type: 19 + defaultvalue: '1' - display: Incident type name: incidentType required: false type: 13 -- additionalinfo: Configure an "IAM - Configuration" incident to specify the Okta - apps you wish to sync to XSOAR. Further information about IAM configuration is - detailed in the Help (the "?" icon). - defaultvalue: 'true' +- additionalinfo: 'Configure an "IAM - Configuration" incident to specify the Okta apps you wish to sync to XSOAR. Further information about IAM configuration is detailed in the Help (the "?" icon).' display: Query only application events configured in IAM Configuration name: auto_generate_query_filter required: false type: 8 -- additionalinfo: 'Use a query filter expression in SCIM format. Note: make sure the - "Query only application events configured in IAM Configuration" is unchecked to - use this parameter. See the Help (the "?" icon) to learn more about the filter - parameter.' - display: Fetch Query Filter (Okta system log events) + defaultvalue: 'true' +- display: Fetch Query Filter (Okta system log events) name: fetch_query_filter required: false type: 0 + additionalinfo: 'Use a query filter expression in SCIM format. Note: make sure the "Query only application events configured in IAM Configuration" is unchecked to use this parameter. See the Help (the "?" icon) to learn more about the filter parameter.' - defaultvalue: 0 minutes display: First fetch timestamp (