Opened on 03/05/2017 at 01:46:51 PM
Closed on 08/06/2018 at 08:29:12 AM
#4954 closed change (fixed)
A downloader script supporting OAuth2 authentication/authorization
Reported by: | kvas | Assignee: | atudor |
---|---|---|---|
Priority: | Unknown | Milestone: | |
Module: | Sitescripts | Keywords: | |
Cc: | atudor | Blocked By: | |
Blocking: | #2492 | Platform: | Unknown / Cross platform |
Ready: | no | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
Description (last modified by atudor)
Background
In order to implement the automation described in #2492 we need a script that can download files using OAuth2 authentication. This ticket provides specification for such a script.
Reference materials:
- OAuth2 for server to server applications,
- Proof of concept on GitGub,
- wsgi_intercept module on PyPI.
What to change
We need a script that can use a service account credentials file to authenticate with an OAuth2 provider, authorize itself for a scope that would allow downloading the requested URL, download the file and output it to stdout.
The script should be placed in 'sitescripts/oauth2dl/bin/oauth2dl.py and invoked as follows:
python -m sitescripts.oauth2dl.bin.oauth2dl [-k <key-file>] [-s <scope>] [-o <path>] <url>
Invocation via python .../oauth2dl.py ... should also be possible. The options can be replaced by environment variables OAUTH2DL_KEY and OAUTH2DL_SCOPE. Options have precedence over the environment variables and each parameter (key file and scope) must be specified in some way.
When the script is invoked correctly, it should output the downloaded data to stdout or write it to the file provided through the -o optional variable. In case of error the error code should be set and the error message printed to stderr.
Tests should be written as well, mocking the server using wsgi_intercept. A successful scenario should be tested as well as the main failure modes.
Attachments (0)
Change History (6)
comment:2 Changed on 07/09/2018 at 09:54:03 AM by atudor
- Cc atudor added
- Owner set to atudor
comment:4 Changed on 07/18/2018 at 01:46:51 PM by atudor
- Review URL(s) modified (diff)
- Status changed from new to reviewing
comment:5 Changed on 08/03/2018 at 04:34:10 PM by abpbot
comment:6 Changed on 08/06/2018 at 08:29:12 AM by atudor
- Resolution set to fixed
- Status changed from reviewing to closed
A commit referencing this issue has landed:
Issue 4954 - Implement a downloader script supporting OAuth2 authentication/authorization