Pass kwargs to auth plugins

Auth plugins must sometimes affect the Headers and other portions
of the network setup.  Examples:  Kerberos needs to set the
negotiate header.  X509 to provide the client certificate.

This change makes that capability available to the Auth plugins.

Those plugins will live in separate repositories. There are no
dependent patches for it in this repository.

This was split out by Adam Young from the Kerberos Client patch
written by Jose Castro Leon

Change-Id: Iab7287888e4b3f199b9035c1a24ac43639b5027b
This commit is contained in:
Jose Castro Leon
2014-09-11 14:56:14 -04:00
committed by Adam Young
parent a9367009ad
commit cde863efcf

View File

@@ -73,9 +73,13 @@ class Auth(base.BaseIdentityPlugin):
headers = {'Accept': 'application/json'}
body = {'auth': {'identity': {}}}
ident = body['auth']['identity']
rkwargs = {}
for method in self.auth_methods:
name, auth_data = method.get_auth_data(session, self, headers)
name, auth_data = method.get_auth_data(session,
self,
headers,
request_kwargs=rkwargs)
ident.setdefault('methods', []).append(name)
ident[name] = auth_data
@@ -112,7 +116,7 @@ class Auth(base.BaseIdentityPlugin):
_logger.debug('Making authentication request to %s', self.token_url)
resp = session.post(self.token_url, json=body, headers=headers,
authenticated=False, log=False)
authenticated=False, log=False, **rkwargs)
try:
resp_data = resp.json()['token']