Skip to content

adding option to enable force msa pass through header #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions vsts/vsts/git/v4_0/git_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def get_vsts_info(self, relative_remote_url):
headers = {'Accept': 'application/json'}
if self._suppress_fedauth_redirect:
headers['X-TFS-FedAuthRedirect'] = 'Suppress'
if self._force_msa_pass_through:
headers['X-VSS-ForceMsaPassThrough'] = 'true'
response = self._send_request(request, headers)
return self._deserialize('VstsInfo', response)

Expand Down
2 changes: 2 additions & 0 deletions vsts/vsts/git/v4_1/git_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ def get_vsts_info(self, relative_remote_url):
headers = {'Accept': 'application/json'}
if self._suppress_fedauth_redirect:
headers['X-TFS-FedAuthRedirect'] = 'Suppress'
if self._force_msa_pass_through:
headers['X-VSS-ForceMsaPassThrough'] = 'true'
response = self._send_request(request, headers)
return self._deserialize('VstsInfo', response)
5 changes: 5 additions & 0 deletions vsts/vsts/vss_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self, base_url=None, creds=None):
self._all_host_types_locations = None
self._locations = None
self._suppress_fedauth_redirect = True
self._force_msa_pass_through = True
self.normalized_url = VssClient._normalize_url(base_url)

def add_user_agent(self, user_agent):
Expand Down Expand Up @@ -88,6 +89,8 @@ def _send(self, http_method, location_id, version, route_values=None,
headers[key] = self.config.additional_headers[key]
if self._suppress_fedauth_redirect:
headers['X-TFS-FedAuthRedirect'] = 'Suppress'
if self._force_msa_pass_through:
headers['X-VSS-ForceMsaPassThrough'] = 'true'
if VssClient._session_header_key in VssClient._session_data and VssClient._session_header_key not in headers:
headers[VssClient._session_header_key] = VssClient._session_data[VssClient._session_header_key]
response = self._send_request(request=request, headers=headers, content=content)
Expand Down Expand Up @@ -173,6 +176,8 @@ def _get_resource_locations(self, all_host_types):
headers = {'Accept': 'application/json'}
if self._suppress_fedauth_redirect:
headers['X-TFS-FedAuthRedirect'] = 'Suppress'
if self._force_msa_pass_through:
headers['X-VSS-ForceMsaPassThrough'] = 'true'
response = self._send_request(request, headers=headers)
wrapper = self._base_deserialize('VssJsonCollectionWrapper', response)
if wrapper is None:
Expand Down