Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
We're trying to migrate some of CKAN's downloads to use the GitHub API to solve problems with download throttling. Part of using the API is supporting authentication tokens. See #2210 for details.
#2263 added the core infrastructure for supporting authentication tokens. This allows GitHub API URLs to be accessed, but the only way the user could do the needed configuration is via
regedit
or another similar tool.Changes
This pull request adds user interfaces for viewing and editing auth tokens.
Each UI validates input to prevent duplicate tokens for the same host and to ensure the host string is a valid host name.
Cmdline
Now there's a new
ckan authtoken
subcommand:ConsoleUI
The main menu has a new "Authentication tokens..." option:
... which takes you to a screen listing them:
... and pressing 'a' brings up this window to create a new one:
GUI
The settings dialog has a new listbox with auth tokens:
Clicking New presents a popup for entering the host and token:
Side fixes
Auto update settings
I noticed during development of these changes that the auto-update settings weren't appearing on Windows. These fields are shown or hidden depending on whether we're allowed to write to ckan.exe, since attempting to auto-update will fail if the administrator user owns the executable. Overwriting the executable for a running process is allowed on Unix-derived systems, but current systems derived from CP/M lock executable files and prevent them from being overwritten while they're running.
Now we always show these fields on Windows.
Auth header
Also, the correct HTTP header for the tokens seems to be
Authorization
, notAuthentication
as we currently have it. This is now fixed,Auto update URLs
Auto-update is broken in current master as of the addition of multiple release assets; we assumed that ckan.exe would be the first asset, but that honor fell to AutoUpdater.exe.
Now we find the asset ending in ckan.exe, similar to how we find AutoUpdater.exe.
Still To Be Done In Future Pull Requests
This is part of the process of fixing #2210. The fix will be complete after:
asset.url
instead ofasset.browser_download_url