Skip to content

Commit

Permalink
Added Auth cookies fix (#60)
Browse files Browse the repository at this point in the history
Co-authored-by: Sergio Muriana <[email protected]>
  • Loading branch information
smuriana and Sergio Muriana authored Aug 2, 2024
1 parent a9416d9 commit eb5ed82
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion automation/check_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def main():
access_token = apigee_auth.get_access_token(username, password)

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': f'Bearer {access_token}'})
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token)})
REQUEST.cookies.update({'access_token': access_token})

keystore_name = apigee_tls_keystore.get_keystore_from_reference(REQUEST, org_name, env_name, ref_name)
crt = apigee_tls_keystore.get_cert_from_alias(REQUEST, org_name, env_name, keystore_name)
Expand Down
1 change: 1 addition & 0 deletions automation/generate_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def main():

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token)})
REQUEST.cookies.update({'access_token': access_token})

# Read JSON file containing analytics query setup information.
data = open(query_path, 'r', encoding='utf8').read()
Expand Down
1 change: 1 addition & 0 deletions automation/get_target_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def main():

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token)})
REQUEST.cookies.update({'access_token': access_token})

result = []

Expand Down
1 change: 1 addition & 0 deletions automation/upload_api_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def main():

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token)})
REQUEST.cookies.update({'access_token': access_token})

# Read JSON file containing API Product setup information.
data = open(product_path, 'r', encoding='utf8').read()
Expand Down
1 change: 1 addition & 0 deletions automation/upload_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def main():

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token)})
REQUEST.cookies.update({'access_token': access_token})

# Check portal and add it if not present
portal = apigee_portal.get_portal(REQUEST, org_name, portal_name)
Expand Down
1 change: 1 addition & 0 deletions automation/upload_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def main():

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token), 'Content-Type': 'application/json'})
REQUEST.cookies.update({'access_token': access_token})

# Check portal and add it if not present
portal = apigee_portal.get_portal(REQUEST, org_name, portal_name)
Expand Down
2 changes: 0 additions & 2 deletions automation/upload_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ def main():

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token), 'Content-Type': 'application/json'})

# Auth cookies Fix: copied from upload_portal_documentation.py:206
REQUEST.cookies.update({'access_token': access_token})

# Load portal configuration ... add or update it.
Expand Down
2 changes: 0 additions & 2 deletions automation/upload_portal_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ def main():

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token)})

# This seems to be expected as of 26/7/2024
REQUEST.cookies.update({'access_token': access_token})

#Check portal and add it if not present
Expand Down
1 change: 1 addition & 0 deletions automation/upload_single_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def main():

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token)})
REQUEST.cookies.update({'access_token': access_token})

# Check portal and add it if not present
portal = apigee_portal.get_portal(REQUEST, org_name, portal_name)
Expand Down
2 changes: 0 additions & 2 deletions automation/upload_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ def main():

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token)})

# This seems to be expected as of 26/7/2024
REQUEST.cookies.update({'access_token': access_token})

# Retrieve all the API specs
Expand Down
1 change: 1 addition & 0 deletions automation/upload_theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def main():

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token), 'Content-Type': 'application/json'})
REQUEST.cookies.update({'access_token': access_token})

# Check portal and add it if not present
portal = apigee_portal.get_portal(REQUEST, org_name, portal_name)
Expand Down
3 changes: 2 additions & 1 deletion automation/upload_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def main():
access_token = apigee_auth.get_access_token(username, password)

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': f'Bearer {access_token}'})
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token)})
REQUEST.cookies.update({'access_token': access_token})

# Retrieve all the keystore
keystore_list = apigee_tls_keystore.get_keystores_list(REQUEST, org_name, env_name)
Expand Down
3 changes: 2 additions & 1 deletion automation/upload_tls_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def main():
access_token = apigee_auth.get_access_token(username, password)

# Add Auth Header by default to all requests.
REQUEST.headers.update({'Authorization': f'Bearer {access_token}'})
REQUEST.headers.update({'Authorization': 'Bearer {}'.format(access_token)})
REQUEST.cookies.update({'access_token': access_token})

# Retrieve all the keystore
keystores_list = apigee_tls_keystore.get_keystores_list(REQUEST, org_name, env_name)
Expand Down

0 comments on commit eb5ed82

Please sign in to comment.