{"action":"created","comment":{"url":"https://api.github.com/repos/jupyter/nbgrader/pulls/comments/26887994","id":26887994,"diff_hunk":"@@ -0,0 +1,123 @@\n+\"\"\"JupyterHub authenticator.\"\"\"\n+import requests\n+import os\n+import json\n+from flask import request, redirect, abort\n+from IPython.utils.traitlets import Unicode, Int, List\n+from .base import BaseAuth\n+from nbgrader.html.formgrade import blueprint\n+\n+\n+class HubAuth(BaseAuth):\n+    \"\"\"Jupyter hub authenticator.\"\"\"\n+\n+    graders = List([], config=True, help=\"List of JupyterHub user names allowed to grade.\")\n+\n+    proxy_address = Unicode(None, config=True, allow_none=True, help=\"Address of the configurable-http-proxy server.\")\n+    proxy_port = Int(8001, config=True, help=\"Port of the configurable-http-proxy server.\")\n+    hub_address = Unicode(None, config=True, allow_none=True, help=\"Address of the hub server.\")","path":"nbgrader/auth/hubauth.py","position":18,"original_position":18,"commit_id":"135d1f2196ce8c046d74d578d70f7ae66657bd3d","original_commit_id":"135d1f2196ce8c046d74d578d70f7ae66657bd3d","user":{"login":"minrk","id":151929,"avatar_url":"https://avatars.githubusercontent.com/u/151929?v=3","gravatar_id":"","url":"https://api.github.com/users/minrk","html_url":"https://github.com/minrk","followers_url":"https://api.github.com/users/minrk/followers","following_url":"https://api.github.com/users/minrk/following{/other_user}","gists_url":"https://api.github.com/users/minrk/gists{/gist_id}","starred_url":"https://api.github.com/users/minrk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minrk/subscriptions","organizations_url":"https://api.github.com/users/minrk/orgs","repos_url":"https://api.github.com/users/minrk/repos","events_url":"https://api.github.com/users/minrk/events{/privacy}","received_events_url":"https://api.github.com/users/minrk/received_events","type":"User","site_admin":false},"body":"These addresses don't need to allow None, they can have \r\n\r\n```python\r\ndef _hub_address_default(self):\r\n    return self._ip\r\n```\r\n\r\nNo need for the init logic below.","created_at":"2015-03-21T02:36:59Z","updated_at":"2015-03-21T02:36:59Z","html_url":"https://github.com/jupyter/nbgrader/pull/157#discussion_r26887994","pull_request_url":"https://api.github.com/repos/jupyter/nbgrader/pulls/157","_links":{"self":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/comments/26887994"},"html":{"href":"https://github.com/jupyter/nbgrader/pull/157#discussion_r26887994"},"pull_request":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/157"}}},"pull_request":{"url":"https://api.github.com/repos/jupyter/nbgrader/pulls/157","id":31572069,"html_url":"https://github.com/jupyter/nbgrader/pull/157","diff_url":"https://github.com/jupyter/nbgrader/pull/157.diff","patch_url":"https://github.com/jupyter/nbgrader/pull/157.patch","issue_url":"https://api.github.com/repos/jupyter/nbgrader/issues/157","number":157,"state":"open","locked":false,"title":"WIP: nbgrader authentication","user":{"login":"jdfreder","id":3292874,"avatar_url":"https://avatars.githubusercontent.com/u/3292874?v=3","gravatar_id":"","url":"https://api.github.com/users/jdfreder","html_url":"https://github.com/jdfreder","followers_url":"https://api.github.com/users/jdfreder/followers","following_url":"https://api.github.com/users/jdfreder/following{/other_user}","gists_url":"https://api.github.com/users/jdfreder/gists{/gist_id}","starred_url":"https://api.github.com/users/jdfreder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdfreder/subscriptions","organizations_url":"https://api.github.com/users/jdfreder/orgs","repos_url":"https://api.github.com/users/jdfreder/repos","events_url":"https://api.github.com/users/jdfreder/events{/privacy}","received_events_url":"https://api.github.com/users/jdfreder/received_events","type":"User","site_admin":false},"body":"Hey @jhamrick ,\r\n\r\nHere's a simple extensible authentication scheme.  \r\n\r\nFormgradeApp.authenticator_class can be used to change the authenticator.  `BaseAuth` is the base authenticator class.  A `NoAuth` class is provided as the default, and retains current behavior of `formgrade`.  I moved the `start_nbserver` traitlet and nbserver launching logic into `NoAuth`.\r\n\r\nThe `HubAuth`, empty now, will contain the logic for authenticating with JupyterHub.\r\n\r\nLet me know what you think of this design.  I've tested it locally and everything seems to work as-is.  The not yet implement `HubAuth` can be tested quickly (when it's done) using `nbgrader formgrade --FormgradeApp.authenticator_class='nbgrader.auth.hubauth.HubAuth'`.\r\n\r\ncloses #145 ","created_at":"2015-03-19T22:19:45Z","updated_at":"2015-03-21T02:36:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"898b82c0f9e3ade29b939d5459da40c3fa6c32c5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jupyter/nbgrader/pulls/157/commits","review_comments_url":"https://api.github.com/repos/jupyter/nbgrader/pulls/157/comments","review_comment_url":"https://api.github.com/repos/jupyter/nbgrader/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jupyter/nbgrader/issues/157/comments","statuses_url":"https://api.github.com/repos/jupyter/nbgrader/statuses/135d1f2196ce8c046d74d578d70f7ae66657bd3d","head":{"label":"jdfreder:auth","ref":"auth","sha":"135d1f2196ce8c046d74d578d70f7ae66657bd3d","user":{"login":"jdfreder","id":3292874,"avatar_url":"https://avatars.githubusercontent.com/u/3292874?v=3","gravatar_id":"","url":"https://api.github.com/users/jdfreder","html_url":"https://github.com/jdfreder","followers_url":"https://api.github.com/users/jdfreder/followers","following_url":"https://api.github.com/users/jdfreder/following{/other_user}","gists_url":"https://api.github.com/users/jdfreder/gists{/gist_id}","starred_url":"https://api.github.com/users/jdfreder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdfreder/subscriptions","organizations_url":"https://api.github.com/users/jdfreder/orgs","repos_url":"https://api.github.com/users/jdfreder/repos","events_url":"https://api.github.com/users/jdfreder/events{/privacy}","received_events_url":"https://api.github.com/users/jdfreder/received_events","type":"User","site_admin":false},"repo":{"id":32471870,"name":"nbgrader","full_name":"jdfreder/nbgrader","owner":{"login":"jdfreder","id":3292874,"avatar_url":"https://avatars.githubusercontent.com/u/3292874?v=3","gravatar_id":"","url":"https://api.github.com/users/jdfreder","html_url":"https://github.com/jdfreder","followers_url":"https://api.github.com/users/jdfreder/followers","following_url":"https://api.github.com/users/jdfreder/following{/other_user}","gists_url":"https://api.github.com/users/jdfreder/gists{/gist_id}","starred_url":"https://api.github.com/users/jdfreder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdfreder/subscriptions","organizations_url":"https://api.github.com/users/jdfreder/orgs","repos_url":"https://api.github.com/users/jdfreder/repos","events_url":"https://api.github.com/users/jdfreder/events{/privacy}","received_events_url":"https://api.github.com/users/jdfreder/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jdfreder/nbgrader","description":"A system for assigning and grading notebooks","fork":true,"url":"https://api.github.com/repos/jdfreder/nbgrader","forks_url":"https://api.github.com/repos/jdfreder/nbgrader/forks","keys_url":"https://api.github.com/repos/jdfreder/nbgrader/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdfreder/nbgrader/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdfreder/nbgrader/teams","hooks_url":"https://api.github.com/repos/jdfreder/nbgrader/hooks","issue_events_url":"https://api.github.com/repos/jdfreder/nbgrader/issues/events{/number}","events_url":"https://api.github.com/repos/jdfreder/nbgrader/events","assignees_url":"https://api.github.com/repos/jdfreder/nbgrader/assignees{/user}","branches_url":"https://api.github.com/repos/jdfreder/nbgrader/branches{/branch}","tags_url":"https://api.github.com/repos/jdfreder/nbgrader/tags","blobs_url":"https://api.github.com/repos/jdfreder/nbgrader/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdfreder/nbgrader/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdfreder/nbgrader/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdfreder/nbgrader/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdfreder/nbgrader/statuses/{sha}","languages_url":"https://api.github.com/repos/jdfreder/nbgrader/languages","stargazers_url":"https://api.github.com/repos/jdfreder/nbgrader/stargazers","contributors_url":"https://api.github.com/repos/jdfreder/nbgrader/contributors","subscribers_url":"https://api.github.com/repos/jdfreder/nbgrader/subscribers","subscription_url":"https://api.github.com/repos/jdfreder/nbgrader/subscription","commits_url":"https://api.github.com/repos/jdfreder/nbgrader/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdfreder/nbgrader/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdfreder/nbgrader/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdfreder/nbgrader/issues/comments{/number}","contents_url":"https://api.github.com/repos/jdfreder/nbgrader/contents/{+path}","compare_url":"https://api.github.com/repos/jdfreder/nbgrader/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdfreder/nbgrader/merges","archive_url":"https://api.github.com/repos/jdfreder/nbgrader/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdfreder/nbgrader/downloads","issues_url":"https://api.github.com/repos/jdfreder/nbgrader/issues{/number}","pulls_url":"https://api.github.com/repos/jdfreder/nbgrader/pulls{/number}","milestones_url":"https://api.github.com/repos/jdfreder/nbgrader/milestones{/number}","notifications_url":"https://api.github.com/repos/jdfreder/nbgrader/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdfreder/nbgrader/labels{/name}","releases_url":"https://api.github.com/repos/jdfreder/nbgrader/releases{/id}","created_at":"2015-03-18T16:53:33Z","updated_at":"2015-03-19T15:48:07Z","pushed_at":"2015-03-20T21:20:28Z","git_url":"git://github.com/jdfreder/nbgrader.git","ssh_url":"git@github.com:jdfreder/nbgrader.git","clone_url":"https://github.com/jdfreder/nbgrader.git","svn_url":"https://github.com/jdfreder/nbgrader","homepage":null,"size":1796,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jupyter:master","ref":"master","sha":"69aee1a7241196574eae34a4fb8c3ffc72246bfa","user":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"repo":{"id":23984796,"name":"nbgrader","full_name":"jupyter/nbgrader","owner":{"login":"jupyter","id":7388996,"avatar_url":"https://avatars.githubusercontent.com/u/7388996?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jupyter/nbgrader","description":"A system for assigning and grading notebooks","fork":false,"url":"https://api.github.com/repos/jupyter/nbgrader","forks_url":"https://api.github.com/repos/jupyter/nbgrader/forks","keys_url":"https://api.github.com/repos/jupyter/nbgrader/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jupyter/nbgrader/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jupyter/nbgrader/teams","hooks_url":"https://api.github.com/repos/jupyter/nbgrader/hooks","issue_events_url":"https://api.github.com/repos/jupyter/nbgrader/issues/events{/number}","events_url":"https://api.github.com/repos/jupyter/nbgrader/events","assignees_url":"https://api.github.com/repos/jupyter/nbgrader/assignees{/user}","branches_url":"https://api.github.com/repos/jupyter/nbgrader/branches{/branch}","tags_url":"https://api.github.com/repos/jupyter/nbgrader/tags","blobs_url":"https://api.github.com/repos/jupyter/nbgrader/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jupyter/nbgrader/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jupyter/nbgrader/git/refs{/sha}","trees_url":"https://api.github.com/repos/jupyter/nbgrader/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jupyter/nbgrader/statuses/{sha}","languages_url":"https://api.github.com/repos/jupyter/nbgrader/languages","stargazers_url":"https://api.github.com/repos/jupyter/nbgrader/stargazers","contributors_url":"https://api.github.com/repos/jupyter/nbgrader/contributors","subscribers_url":"https://api.github.com/repos/jupyter/nbgrader/subscribers","subscription_url":"https://api.github.com/repos/jupyter/nbgrader/subscription","commits_url":"https://api.github.com/repos/jupyter/nbgrader/commits{/sha}","git_commits_url":"https://api.github.com/repos/jupyter/nbgrader/git/commits{/sha}","comments_url":"https://api.github.com/repos/jupyter/nbgrader/comments{/number}","issue_comment_url":"https://api.github.com/repos/jupyter/nbgrader/issues/comments{/number}","contents_url":"https://api.github.com/repos/jupyter/nbgrader/contents/{+path}","compare_url":"https://api.github.com/repos/jupyter/nbgrader/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jupyter/nbgrader/merges","archive_url":"https://api.github.com/repos/jupyter/nbgrader/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jupyter/nbgrader/downloads","issues_url":"https://api.github.com/repos/jupyter/nbgrader/issues{/number}","pulls_url":"https://api.github.com/repos/jupyter/nbgrader/pulls{/number}","milestones_url":"https://api.github.com/repos/jupyter/nbgrader/milestones{/number}","notifications_url":"https://api.github.com/repos/jupyter/nbgrader/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jupyter/nbgrader/labels{/name}","releases_url":"https://api.github.com/repos/jupyter/nbgrader/releases{/id}","created_at":"2014-09-13T03:27:36Z","updated_at":"2015-03-20T19:56:44Z","pushed_at":"2015-03-21T02:24:19Z","git_url":"git://github.com/jupyter/nbgrader.git","ssh_url":"git@github.com:jupyter/nbgrader.git","clone_url":"https://github.com/jupyter/nbgrader.git","svn_url":"https://github.com/jupyter/nbgrader","homepage":null,"size":3230,"stargazers_count":25,"watchers_count":25,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":32,"forks":8,"open_issues":32,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/157"},"html":{"href":"https://github.com/jupyter/nbgrader/pull/157"},"issue":{"href":"https://api.github.com/repos/jupyter/nbgrader/issues/157"},"comments":{"href":"https://api.github.com/repos/jupyter/nbgrader/issues/157/comments"},"review_comments":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/157/comments"},"review_comment":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/157/commits"},"statuses":{"href":"https://api.github.com/repos/jupyter/nbgrader/statuses/135d1f2196ce8c046d74d578d70f7ae66657bd3d"}}}}