Skip to content

Commit 9101dec

Browse files
committed
SLK-103546 - Add Token Authentication Fallback Support
- Add X-Tokens-Signature header to all API key-authenticated requests - Calculate tokens signature using existing get_signature function with /v2/tokens endpoint - Update trigger-aws.py: add header to get_cspm_key_id(), trigger_discovery(), and update_credentials() functions - Update create_cspm_key.py: add header to get_cspm_key_id() and create_cspm_key() functions - Update generate_external_id.py: add header to generate_external_id() function - Enable backend fallback to Bearer token authentication when API key authentication fails
1 parent e582417 commit 9101dec

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

modules/project_attachment/trigger-gcp.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,19 @@ def get_headers(cspm_key, cspm_method='GET', body_cspm=''):
4949
body =body_cspm
5050
)
5151

52+
tokens_signature = get_signature(
53+
api_secret=aqua_api_secret,
54+
timestamp=timestamp,
55+
path="/v2/tokens",
56+
method="POST",
57+
body='{"validity":1,"allowed_endpoints":["ANY"]}'
58+
)
59+
5260
headers = {
5361
"X-API-Key": aqua_api_key,
5462
"X-Authenticate-Api-Key-Signature": internal_signature,
5563
"X-Register-New-Cspm-Signature": signature_cspm_keys,
64+
"X-Tokens-Signature": tokens_signature,
5665
"X-Timestamp": timestamp,
5766
"Content-Type": "application/json"
5867
}

0 commit comments

Comments
 (0)