Skip to content

Commit

Permalink
Add authorization token to use GCP IAP (#16)
Browse files Browse the repository at this point in the history
Using the header `Proxy-Authorization` does not work because it is deleted by
https://github.com/psf/requests/blob/2a438c27b5a5828c8ea0dc958112eecffca70b12/src/requests/sessions.py#L318-L319.
  • Loading branch information
Zawadidone authored Apr 8, 2024
1 parent 9053f9a commit 476b3f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api_client/python/timesketch_api_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,10 @@ def _create_session(

session = requests.Session()

# GCP IAP
if token := os.getenv("AUTHORIZATION_TOKEN"):
session.headers = {"Authorization": f"Bearer {token}"}

# If using HTTP Basic auth, add the user/pass to the session
if auth_mode == "http-basic":
session.auth = (username, password)
Expand Down

0 comments on commit 476b3f8

Please sign in to comment.