mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-05 07:49:10 -07:00
Try to enable more exotic auth methods in httpapi (#43212)
* Try to enable more exotic auth methods in httpapi * Auth tokens won't always come back. * Reconcile #43147 with this PR
This commit is contained in:
parent
ac1f05478e
commit
a7097f6735
2 changed files with 39 additions and 5 deletions
|
@ -28,6 +28,27 @@ class HttpApiBase(AnsiblePlugin):
|
|||
"""
|
||||
pass
|
||||
|
||||
def logout(self):
|
||||
""" Call to implement session logout.
|
||||
|
||||
Method to clear session gracefully e.g. tokens granted in login
|
||||
need to be revoked.
|
||||
"""
|
||||
pass
|
||||
|
||||
def update_auth(self, response):
|
||||
"""Return per-request auth token.
|
||||
|
||||
The response should be a dictionary that can be plugged into the
|
||||
headers of a request. The default implementation uses cookie data.
|
||||
If no authentication data is found, return None
|
||||
"""
|
||||
cookie = response.info().get('Set-Cookie')
|
||||
if cookie:
|
||||
return {'Cookie': cookie}
|
||||
|
||||
return None
|
||||
|
||||
@abstractmethod
|
||||
def send_request(self, data, **message_kwargs):
|
||||
"""Prepares and sends request(s) to device."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue