{"action":"created","comment":{"url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/comments/65099994","id":65099994,"diff_hunk":"@@ -71,42 +72,62 @@ class WebApiWithAuthenticationSpec extends FunSpec with Matchers with BeforeAndA\n     api.myRoutes\n   }\n \n-  private val routes = routesWithTimeout(\"1 s\")\n+  private val routesWithProxyUser = routesWithTimeout(true, \"1 s\")\n+  private val routesWithoutProxyUser = routesWithTimeout(false, \"1 s\")\n \n+  private val USER_NAME = \"presidentskroob\"\n   // set to some valid user\n-  private val authorization = new Authorization(new BasicHttpCredentials(\"presidentskroob\", \"12345\"))\n-  private val authorizationInvalidPassword = new Authorization(new BasicHttpCredentials(\"presidentskroob\", \"xxx\"))\n+  private val authorization = new Authorization(new BasicHttpCredentials(USER_NAME, \"12345\"))\n+  private val authorizationInvalidPassword = new Authorization(new BasicHttpCredentials(USER_NAME, \"xxx\"))\n   private val authorizationUnknownUser = new Authorization(new BasicHttpCredentials(\"whoami\", \"xxx\"))\n   private val dt = DateTime.parse(\"2013-05-29T00Z\")\n   private val jobInfo = JobInfo(\"foo-1\", \"context\", JarInfo(\"demo\", dt), \"com.abc.meme\", dt, None, None)\n   private val ResultKey = \"result\"\n \n+  private val addedContexts = new scala.collection.mutable.HashSet[String] with SynchronizedSet[String]\n+\n   class DummyActor extends Actor {\n     import CommonMessages._\n     import JobInfoActor._\n     def receive = {\n       case ListJars                       => sender ! Map()\n       case GetJobStatus(id)               => sender ! jobInfo\n       case GetJobResult(id)               => sender ! JobResult(id, id + \"!!!\")\n-      case ContextSupervisor.ListContexts => sender ! Seq(\"context1\", \"context2\")\n+      case ContextSupervisor.ListContexts => sender ! addedContexts.toSeq\n+      case ContextSupervisor.AddContext(name, _) =>\n+        if (addedContexts.contains(name)) {\n+          sender ! ContextSupervisor.ContextAlreadyExists\n+        } else {\n+          addedContexts.add(name)\n+          sender ! ContextSupervisor.ContextInitialized\n+        }\n+      case ContextSupervisor.StopContext(name) =>\n+        addedContexts.remove(name)\n+        sender ! ContextSupervisor.ContextStopped\n+      case ContextSupervisor.AddContextsFromConfig =>\n+        sender ! \"OK\"\n+      case m =>\n+        //dev support when adding new test cases:\n+        println(\"Unhandled message: \" + m)","path":"job-server/test/spark.jobserver/auth/WebApiWithAuthenticationSpec.scala","position":75,"original_position":75,"commit_id":"3c12201ecdbaf8e4ef9a0d73cff31d0811c373fe","original_commit_id":"3c12201ecdbaf8e4ef9a0d73cff31d0811c373fe","user":{"login":"TimMaltGermany","id":7852234,"avatar_url":"https://avatars.githubusercontent.com/u/7852234?v=3","gravatar_id":"","url":"https://api.github.com/users/TimMaltGermany","html_url":"https://github.com/TimMaltGermany","followers_url":"https://api.github.com/users/TimMaltGermany/followers","following_url":"https://api.github.com/users/TimMaltGermany/following{/other_user}","gists_url":"https://api.github.com/users/TimMaltGermany/gists{/gist_id}","starred_url":"https://api.github.com/users/TimMaltGermany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimMaltGermany/subscriptions","organizations_url":"https://api.github.com/users/TimMaltGermany/orgs","repos_url":"https://api.github.com/users/TimMaltGermany/repos","events_url":"https://api.github.com/users/TimMaltGermany/events{/privacy}","received_events_url":"https://api.github.com/users/TimMaltGermany/received_events","type":"User","site_admin":false},"body":"you mean 'sys.error(\"Unhandled message: \" + m)' ? \r\nThis is a test class after all. I could also just remove that case.","created_at":"2016-05-30T19:00:27Z","updated_at":"2016-05-30T19:00:27Z","html_url":"https://github.com/spark-jobserver/spark-jobserver/pull/469#discussion_r65099994","pull_request_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/469","_links":{"self":{"href":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/comments/65099994"},"html":{"href":"https://github.com/spark-jobserver/spark-jobserver/pull/469#discussion_r65099994"},"pull_request":{"href":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/469"}}},"pull_request":{"url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/469","id":70975569,"html_url":"https://github.com/spark-jobserver/spark-jobserver/pull/469","diff_url":"https://github.com/spark-jobserver/spark-jobserver/pull/469.diff","patch_url":"https://github.com/spark-jobserver/spark-jobserver/pull/469.patch","issue_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/issues/469","number":469,"state":"open","locked":false,"title":"Per-user authenticated contexts","user":{"login":"TimMaltGermany","id":7852234,"avatar_url":"https://avatars.githubusercontent.com/u/7852234?v=3","gravatar_id":"","url":"https://api.github.com/users/TimMaltGermany","html_url":"https://github.com/TimMaltGermany","followers_url":"https://api.github.com/users/TimMaltGermany/followers","following_url":"https://api.github.com/users/TimMaltGermany/following{/other_user}","gists_url":"https://api.github.com/users/TimMaltGermany/gists{/gist_id}","starred_url":"https://api.github.com/users/TimMaltGermany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimMaltGermany/subscriptions","organizations_url":"https://api.github.com/users/TimMaltGermany/orgs","repos_url":"https://api.github.com/users/TimMaltGermany/repos","events_url":"https://api.github.com/users/TimMaltGermany/events{/privacy}","received_events_url":"https://api.github.com/users/TimMaltGermany/received_events","type":"User","site_admin":false},"body":"Added option to require that proxy users must be identical to the authenticated user.\r\n\r\nIn order to support secured clusters it is necessary to ensure that the user running a spark context is identical to the authenticated user. We added a boolean configuration option (`shiro.use-as-proxy-user`). When authentication and this flag are activated, then spark.proxy.user is always set to the name of the authenticated user. Users will ever only see and be able to manipulate their own contexts. An internal prefix is used to ensure that no naming conflicts arise when different users use the same name for their respective contexts.\r\n\r\nNote that in this case the `spark.proxy.user` parameter in the following call is always ignored!\r\nPOST /contexts/my-new-context?spark.proxy.user=<IGNORED>\r\n\r\n\r\n","created_at":"2016-05-22T12:17:40Z","updated_at":"2016-05-30T19:00:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9a9f2609bb3679fbfd9581f489521ed59feec844","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/469/commits","review_comments_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/469/comments","review_comment_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/issues/469/comments","statuses_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/statuses/3c12201ecdbaf8e4ef9a0d73cff31d0811c373fe","head":{"label":"koettert:authenticated-proxy","ref":"authenticated-proxy","sha":"3c12201ecdbaf8e4ef9a0d73cff31d0811c373fe","user":{"login":"koettert","id":11409922,"avatar_url":"https://avatars.githubusercontent.com/u/11409922?v=3","gravatar_id":"","url":"https://api.github.com/users/koettert","html_url":"https://github.com/koettert","followers_url":"https://api.github.com/users/koettert/followers","following_url":"https://api.github.com/users/koettert/following{/other_user}","gists_url":"https://api.github.com/users/koettert/gists{/gist_id}","starred_url":"https://api.github.com/users/koettert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koettert/subscriptions","organizations_url":"https://api.github.com/users/koettert/orgs","repos_url":"https://api.github.com/users/koettert/repos","events_url":"https://api.github.com/users/koettert/events{/privacy}","received_events_url":"https://api.github.com/users/koettert/received_events","type":"User","site_admin":false},"repo":{"id":41287905,"name":"spark-jobserver","full_name":"koettert/spark-jobserver","owner":{"login":"koettert","id":11409922,"avatar_url":"https://avatars.githubusercontent.com/u/11409922?v=3","gravatar_id":"","url":"https://api.github.com/users/koettert","html_url":"https://github.com/koettert","followers_url":"https://api.github.com/users/koettert/followers","following_url":"https://api.github.com/users/koettert/following{/other_user}","gists_url":"https://api.github.com/users/koettert/gists{/gist_id}","starred_url":"https://api.github.com/users/koettert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koettert/subscriptions","organizations_url":"https://api.github.com/users/koettert/orgs","repos_url":"https://api.github.com/users/koettert/repos","events_url":"https://api.github.com/users/koettert/events{/privacy}","received_events_url":"https://api.github.com/users/koettert/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/koettert/spark-jobserver","description":"REST job server for Apache Spark","fork":true,"url":"https://api.github.com/repos/koettert/spark-jobserver","forks_url":"https://api.github.com/repos/koettert/spark-jobserver/forks","keys_url":"https://api.github.com/repos/koettert/spark-jobserver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/koettert/spark-jobserver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/koettert/spark-jobserver/teams","hooks_url":"https://api.github.com/repos/koettert/spark-jobserver/hooks","issue_events_url":"https://api.github.com/repos/koettert/spark-jobserver/issues/events{/number}","events_url":"https://api.github.com/repos/koettert/spark-jobserver/events","assignees_url":"https://api.github.com/repos/koettert/spark-jobserver/assignees{/user}","branches_url":"https://api.github.com/repos/koettert/spark-jobserver/branches{/branch}","tags_url":"https://api.github.com/repos/koettert/spark-jobserver/tags","blobs_url":"https://api.github.com/repos/koettert/spark-jobserver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/koettert/spark-jobserver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/koettert/spark-jobserver/git/refs{/sha}","trees_url":"https://api.github.com/repos/koettert/spark-jobserver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/koettert/spark-jobserver/statuses/{sha}","languages_url":"https://api.github.com/repos/koettert/spark-jobserver/languages","stargazers_url":"https://api.github.com/repos/koettert/spark-jobserver/stargazers","contributors_url":"https://api.github.com/repos/koettert/spark-jobserver/contributors","subscribers_url":"https://api.github.com/repos/koettert/spark-jobserver/subscribers","subscription_url":"https://api.github.com/repos/koettert/spark-jobserver/subscription","commits_url":"https://api.github.com/repos/koettert/spark-jobserver/commits{/sha}","git_commits_url":"https://api.github.com/repos/koettert/spark-jobserver/git/commits{/sha}","comments_url":"https://api.github.com/repos/koettert/spark-jobserver/comments{/number}","issue_comment_url":"https://api.github.com/repos/koettert/spark-jobserver/issues/comments{/number}","contents_url":"https://api.github.com/repos/koettert/spark-jobserver/contents/{+path}","compare_url":"https://api.github.com/repos/koettert/spark-jobserver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/koettert/spark-jobserver/merges","archive_url":"https://api.github.com/repos/koettert/spark-jobserver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/koettert/spark-jobserver/downloads","issues_url":"https://api.github.com/repos/koettert/spark-jobserver/issues{/number}","pulls_url":"https://api.github.com/repos/koettert/spark-jobserver/pulls{/number}","milestones_url":"https://api.github.com/repos/koettert/spark-jobserver/milestones{/number}","notifications_url":"https://api.github.com/repos/koettert/spark-jobserver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/koettert/spark-jobserver/labels{/name}","releases_url":"https://api.github.com/repos/koettert/spark-jobserver/releases{/id}","deployments_url":"https://api.github.com/repos/koettert/spark-jobserver/deployments","created_at":"2015-08-24T07:08:17Z","updated_at":"2016-02-14T12:18:19Z","pushed_at":"2016-05-22T14:02:11Z","git_url":"git://github.com/koettert/spark-jobserver.git","ssh_url":"git@github.com:koettert/spark-jobserver.git","clone_url":"https://github.com/koettert/spark-jobserver.git","svn_url":"https://github.com/koettert/spark-jobserver","homepage":"","size":1468,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"spark-jobserver:master","ref":"master","sha":"01d29932d97baad9f3451be20d19aaa7cd67c746","user":{"login":"spark-jobserver","id":8494302,"avatar_url":"https://avatars.githubusercontent.com/u/8494302?v=3","gravatar_id":"","url":"https://api.github.com/users/spark-jobserver","html_url":"https://github.com/spark-jobserver","followers_url":"https://api.github.com/users/spark-jobserver/followers","following_url":"https://api.github.com/users/spark-jobserver/following{/other_user}","gists_url":"https://api.github.com/users/spark-jobserver/gists{/gist_id}","starred_url":"https://api.github.com/users/spark-jobserver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spark-jobserver/subscriptions","organizations_url":"https://api.github.com/users/spark-jobserver/orgs","repos_url":"https://api.github.com/users/spark-jobserver/repos","events_url":"https://api.github.com/users/spark-jobserver/events{/privacy}","received_events_url":"https://api.github.com/users/spark-jobserver/received_events","type":"Organization","site_admin":false},"repo":{"id":23205911,"name":"spark-jobserver","full_name":"spark-jobserver/spark-jobserver","owner":{"login":"spark-jobserver","id":8494302,"avatar_url":"https://avatars.githubusercontent.com/u/8494302?v=3","gravatar_id":"","url":"https://api.github.com/users/spark-jobserver","html_url":"https://github.com/spark-jobserver","followers_url":"https://api.github.com/users/spark-jobserver/followers","following_url":"https://api.github.com/users/spark-jobserver/following{/other_user}","gists_url":"https://api.github.com/users/spark-jobserver/gists{/gist_id}","starred_url":"https://api.github.com/users/spark-jobserver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spark-jobserver/subscriptions","organizations_url":"https://api.github.com/users/spark-jobserver/orgs","repos_url":"https://api.github.com/users/spark-jobserver/repos","events_url":"https://api.github.com/users/spark-jobserver/events{/privacy}","received_events_url":"https://api.github.com/users/spark-jobserver/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spark-jobserver/spark-jobserver","description":"REST job server for Apache Spark","fork":false,"url":"https://api.github.com/repos/spark-jobserver/spark-jobserver","forks_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/forks","keys_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/teams","hooks_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/hooks","issue_events_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/issues/events{/number}","events_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/events","assignees_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/assignees{/user}","branches_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/branches{/branch}","tags_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/tags","blobs_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/git/refs{/sha}","trees_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/statuses/{sha}","languages_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/languages","stargazers_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/stargazers","contributors_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/contributors","subscribers_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/subscribers","subscription_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/subscription","commits_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/commits{/sha}","git_commits_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/git/commits{/sha}","comments_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/comments{/number}","issue_comment_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/issues/comments{/number}","contents_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/contents/{+path}","compare_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/merges","archive_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/downloads","issues_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/issues{/number}","pulls_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls{/number}","milestones_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/milestones{/number}","notifications_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/labels{/name}","releases_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/releases{/id}","deployments_url":"https://api.github.com/repos/spark-jobserver/spark-jobserver/deployments","created_at":"2014-08-21T23:07:47Z","updated_at":"2016-05-30T15:33:00Z","pushed_at":"2016-05-30T11:52:25Z","git_url":"git://github.com/spark-jobserver/spark-jobserver.git","ssh_url":"git@github.com:spark-jobserver/spark-jobserver.git","clone_url":"https://github.com/spark-jobserver/spark-jobserver.git","svn_url":"https://github.com/spark-jobserver/spark-jobserver","homepage":"","size":4904,"stargazers_count":1046,"watchers_count":1046,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":428,"mirror_url":null,"open_issues_count":98,"forks":428,"open_issues":98,"watchers":1046,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/469"},"html":{"href":"https://github.com/spark-jobserver/spark-jobserver/pull/469"},"issue":{"href":"https://api.github.com/repos/spark-jobserver/spark-jobserver/issues/469"},"comments":{"href":"https://api.github.com/repos/spark-jobserver/spark-jobserver/issues/469/comments"},"review_comments":{"href":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/469/comments"},"review_comment":{"href":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spark-jobserver/spark-jobserver/pulls/469/commits"},"statuses":{"href":"https://api.github.com/repos/spark-jobserver/spark-jobserver/statuses/3c12201ecdbaf8e4ef9a0d73cff31d0811c373fe"}}}}
{"actor":{"display_login":"TimMaltGermany"}}