force_basic_auth for default httpapi connection auth (#59193)

The default for a httpapi connection is to do basic auth, however
when setting the url_username and url_password without
force_basic_auth, the call to ansible.module_utils.open_url would
not always properly handle the basic auth headers based on the
combinations of **kwargs passed. This ensures that is always the
case when no session token exists and as the goal is to use basic
auth in the event of not having a session token, this should be
a safe operation.

Signed-off-by: Adam Miller <admiller@redhat.com>
pull/59619/head
Adam Miller 5 years ago committed by GitHub
parent 3a103405b1
commit 49da47d09f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -265,6 +265,7 @@ class Connection(NetworkConnectionBase):
headers.update(self._auth) headers.update(self._auth)
url_kwargs['headers'] = headers url_kwargs['headers'] = headers
else: else:
url_kwargs['force_basic_auth'] = True
url_kwargs['url_username'] = self.get_option('remote_user') url_kwargs['url_username'] = self.get_option('remote_user')
url_kwargs['url_password'] = self.get_option('password') url_kwargs['url_password'] = self.get_option('password')

Loading…
Cancel
Save