client: Add OpenID Connect bearer token authentication
By providing a refresh token, obtained with the swh auth login
command to the new authenticate
method of the client, all emitted requests
will be authenticated using a bearer token sent in headers.
Example of use:
from swh.web.client import WebAPIClient
REFRESH_TOKEN = '.......' # Use "swh auth login" command to get it
client = WebAPIClient()
client.authenticate(REFRESH_TOKEN)
# All requests to the Web API will be authenticated
resp = client.get('swh:1:rev:aafb16d69fd30ff58afdd69036a26047f3aebdc6')
Depends on !2 (closed)
Related to swh-web#1927 (closed)
Migrated from D2869 (view on Phabricator)
Merge request reports
Activity
Build has FAILED
Link to build: https://jenkins.softwareheritage.org/job/DWCLI/job/tox/13/ See console output for more information: https://jenkins.softwareheritage.org/job/DWCLI/job/tox/13/console
! In !3 (closed), @swh-public-ci wrote: Build has FAILED
Link to build: https://jenkins.softwareheritage.org/job/DWCLI/job/tox/13/ See console output for more information: https://jenkins.softwareheritage.org/job/DWCLI/job/tox/13/console
Looks like I need to update my local version of
mypy
as I did no get those errors.swh/web/client/client.py:432: error: Unsupported right operand type for in ("Optional[Dict[str, Any]]") swh/web/client/client.py:433: error: Value of type "Optional[Dict[str, Any]]" is not indexable swh/web/client/client.py:435: error: Unsupported target for indexed assignment swh/web/client/client.py:438: error: Unsupported right operand type for in ("Optional[Dict[str, Any]]")
Build is green See https://jenkins.softwareheritage.org/job/DWCLI/job/tox/14/ for more details.
Build is green See https://jenkins.softwareheritage.org/job/DWCLI/job/tox/16/ for more details.
Some references in the commit message have been migrated:
- T1927 is now swh-web#1927 (closed)
Build is green See https://jenkins.softwareheritage.org/job/DWCLI/job/tox/17/ for more details.