Skip to content

Commit

Permalink
allow host address input in MS Graph configuration (#1582)
Browse files Browse the repository at this point in the history
  • Loading branch information
delliott90 authored Sep 28, 2023
1 parent df8dee5 commit 365011d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions stix_shifter_modules/azure_sentinel/configuration/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"displayName": "Microsoft Graph Security",
"group": "microsoft"
},
"host": {
"type": "text",
"regex": "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9_:/\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9_:/\\-]*[A-Za-z0-9])$",
"default": "graph.microsoft.com"
},
"port": {
"type": "number",
"default": 443,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class APIClient:
"""API Client to handle all calls."""
credential = None

def __init__(self, base_uri, connection, configuration):
def __init__(self, connection, configuration):
"""Initialization.
:param connection: dict, connection dict
:param configuration: dict,config dict"""
self.host = base_uri
self.host = connection['host']
self.connection = connection
self.configuration = configuration
self.timeout = connection['options'].get('timeout')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
class Connector(BaseJsonSyncConnector):
api_client = None
max_limit = 1000
base_uri = 'graph.microsoft.com' # Microsoft Graph API has single endpoint
DEFAULT_API_VERSION = 'v1.0'
LEGACY_ALERT = 'security/alerts'
ALERT_V2 = 'security/alerts_v2'
Expand All @@ -22,7 +21,7 @@ def __init__(self, connection, configuration):
self.connector = __name__.split('.')[1]
self.connection = connection
self.configuration = configuration
self.api_client = APIClient(self.base_uri, self.connection, self.configuration)
self.api_client = APIClient(self.connection, self.configuration)

self.legacy_alert = connection['options'].get('alert')
self.alert_v2 = connection['options'].get('alertV2')
Expand Down

0 comments on commit 365011d

Please sign in to comment.