Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User interfaces for auth tokens #2266

Merged
merged 1 commit into from
Feb 3, 2018

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Jan 28, 2018

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:

>ckan authtoken
CKAN 1.24.0-PRE2+c2bdd52cabf8
Copyright c 2014-2017

ckan authtoken - Manage authentication tokens
Usage: ckan authtoken <command> [options]

  list      List auth tokens

  add       Add an auth token

  remove    Delete an auth token

You are using CKAN version v1.24.0-PRE2+c2bdd52cabf8
>ckan authtoken list
Host           Token
-------------  -------------------------------
test.host.com  dsaf976as9d8pfh769ad8g7ja98a75d

ConsoleUI

The main menu has a new "Authentication tokens..." option:

image

... which takes you to a screen listing them:

image

... and pressing 'a' brings up this window to create a new one:

image

GUI

The settings dialog has a new listbox with auth tokens:

image

Clicking New presents a popup for entering the host and token:

image

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, not Authentication 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:

  • netkan update to use asset.url instead of asset.browser_download_url
  • Conversion of existing URLs to use the API

@HebaruSan HebaruSan added Enhancement New features or functionality GUI Issues affecting the interactive GUI Cmdline Issues affecting the command line Pull request Network Issues affecting internet connections of CKAN labels Jan 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cmdline Issues affecting the command line Enhancement New features or functionality GUI Issues affecting the interactive GUI Network Issues affecting internet connections of CKAN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants