Skip to content

Commit

Permalink
Add authorization token to use GCP IAP
Browse files Browse the repository at this point in the history
Setting the header `Proxy-Authorization` does not work because it is
deleted: https://github.com/psf/requests/blob/2a438c27b5a5828c8ea0dc958112eecffca70b12/src/requests/sessions.py#L318-L319.
  • Loading branch information
Zawadidone committed Apr 5, 2024
1 parent 2ceeb13 commit 993985f
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 993985f

Please sign in to comment.