{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments/55270670","id":55270670,"diff_hunk":"@@ -279,13 +281,24 @@ public void doCreateAccountByAdmin(StaplerRequest req, StaplerResponse rsp) thro\n      * This can be run by anyone, but only to create the very first user account.\n      */\n     public void doCreateFirstAccount(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {\n-        if(hasSomeUser()) {\n+        boolean inSetup = !Jenkins.getInstance().getInstallState().isSetupComplete();\n+        if(!inSetup && hasSomeUser()) {\n             rsp.sendError(SC_UNAUTHORIZED,\"First user was already created\");\n             return;\n         }\n-        User u = createAccount(req, rsp, false, \"firstUser.jelly\");\n+        String view = \"firstUser.jelly\";\n+        User admin = null;\n+        if(inSetup) {\n+            admin = getUser(SetupWizard.initialSetupAdminUserName);\n+            view = \"setupWizardFirstUser.jelly\";\n+        }\n+        User u = createAccount(req, rsp, false, view);\n         if (u!=null) {\n             tryToMakeAdmin(u);\n+            if(admin != null) {\n+                admin.delete();","path":"core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java","position":62,"original_position":62,"commit_id":"08b6ff33687883d90b22ec83c385713afe3c6adf","original_commit_id":"08b6ff33687883d90b22ec83c385713afe3c6adf","user":{"login":"daniel-beck","id":1831569,"avatar_url":"https://avatars.githubusercontent.com/u/1831569?v=3","gravatar_id":"","url":"https://api.github.com/users/daniel-beck","html_url":"https://github.com/daniel-beck","followers_url":"https://api.github.com/users/daniel-beck/followers","following_url":"https://api.github.com/users/daniel-beck/following{/other_user}","gists_url":"https://api.github.com/users/daniel-beck/gists{/gist_id}","starred_url":"https://api.github.com/users/daniel-beck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daniel-beck/subscriptions","organizations_url":"https://api.github.com/users/daniel-beck/orgs","repos_url":"https://api.github.com/users/daniel-beck/repos","events_url":"https://api.github.com/users/daniel-beck/events{/privacy}","received_events_url":"https://api.github.com/users/daniel-beck/received_events","type":"User","site_admin":false},"body":"@jglick I think the intention is to have a temporary admin account for the setup only, and then have a complete user registration (with email, full name, and custom password) afterwards.","created_at":"2016-03-07T20:57:37Z","updated_at":"2016-03-07T20:57:37Z","html_url":"https://github.com/jenkinsci/jenkins/pull/2042#discussion_r55270670","pull_request_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/2042","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments/55270670"},"html":{"href":"https://github.com/jenkinsci/jenkins/pull/2042#discussion_r55270670"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/2042"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/2042","id":59965424,"html_url":"https://github.com/jenkinsci/jenkins/pull/2042","diff_url":"https://github.com/jenkinsci/jenkins/pull/2042.diff","patch_url":"https://github.com/jenkinsci/jenkins/pull/2042.patch","issue_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/2042","number":2042,"state":"open","locked":false,"title":"Make Jenkins secure by default","user":{"login":"kzantow","id":3009477,"avatar_url":"https://avatars.githubusercontent.com/u/3009477?v=3","gravatar_id":"","url":"https://api.github.com/users/kzantow","html_url":"https://github.com/kzantow","followers_url":"https://api.github.com/users/kzantow/followers","following_url":"https://api.github.com/users/kzantow/following{/other_user}","gists_url":"https://api.github.com/users/kzantow/gists{/gist_id}","starred_url":"https://api.github.com/users/kzantow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzantow/subscriptions","organizations_url":"https://api.github.com/users/kzantow/orgs","repos_url":"https://api.github.com/users/kzantow/repos","events_url":"https://api.github.com/users/kzantow/events{/privacy}","received_events_url":"https://api.github.com/users/kzantow/received_events","type":"User","site_admin":false},"body":"Make Jenkins 'secure' by default:\r\n* Modify setup wizard to include security configuration\r\n*  modify default security settings to be opt-out\r\n* do not spawn listening ports (JNLP/DNS/etc.)\r\n* force user to create a first admin user if using database auth & not using unsecured strategy\r\n\r\nTODO:\r\n- [x] defer services startup\r\n- [x] apply defaults to security config page\r\n- [x] reference the [mini-design doc](https://docs.google.com/document/d/1kD3xVoarOaHPEs1yi1VaES12Ksca_NKRNYA3MDsdu_k)\r\n- [x] integrate security setup directly in setup wizard (vs. iframe)\r\n- [x] add proxy configuration\r\n- [x] code cleanup per guidelines\r\n- [x] require a security token to prevent arbitrary access\r\n- [x] test multiple plugin installation scenarios\r\n- [x] Known issue: connectivity check does not re-run\r\n- [x] ~~add 'test setup' to security configuration (probably should defer this to another PR)~~\r\n\r\nSee: [JENKINS-30749](https://issues.jenkins-ci.org/browse/JENKINS-30749)","created_at":"2016-02-19T15:40:53Z","updated_at":"2016-03-07T20:57:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d685f2d215483530873b14d902072331ae4c3fbc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/2042/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/2042/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/2042/comments","statuses_url":"https://api.github.com/repos/jenkinsci/jenkins/statuses/08b6ff33687883d90b22ec83c385713afe3c6adf","head":{"label":"kzantow:2.0","ref":"2.0","sha":"08b6ff33687883d90b22ec83c385713afe3c6adf","user":{"login":"kzantow","id":3009477,"avatar_url":"https://avatars.githubusercontent.com/u/3009477?v=3","gravatar_id":"","url":"https://api.github.com/users/kzantow","html_url":"https://github.com/kzantow","followers_url":"https://api.github.com/users/kzantow/followers","following_url":"https://api.github.com/users/kzantow/following{/other_user}","gists_url":"https://api.github.com/users/kzantow/gists{/gist_id}","starred_url":"https://api.github.com/users/kzantow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzantow/subscriptions","organizations_url":"https://api.github.com/users/kzantow/orgs","repos_url":"https://api.github.com/users/kzantow/repos","events_url":"https://api.github.com/users/kzantow/events{/privacy}","received_events_url":"https://api.github.com/users/kzantow/received_events","type":"User","site_admin":false},"repo":{"id":41372898,"name":"jenkins","full_name":"kzantow/jenkins","owner":{"login":"kzantow","id":3009477,"avatar_url":"https://avatars.githubusercontent.com/u/3009477?v=3","gravatar_id":"","url":"https://api.github.com/users/kzantow","html_url":"https://github.com/kzantow","followers_url":"https://api.github.com/users/kzantow/followers","following_url":"https://api.github.com/users/kzantow/following{/other_user}","gists_url":"https://api.github.com/users/kzantow/gists{/gist_id}","starred_url":"https://api.github.com/users/kzantow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzantow/subscriptions","organizations_url":"https://api.github.com/users/kzantow/orgs","repos_url":"https://api.github.com/users/kzantow/repos","events_url":"https://api.github.com/users/kzantow/events{/privacy}","received_events_url":"https://api.github.com/users/kzantow/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kzantow/jenkins","description":"Jenkins Continuous Integration Server","fork":true,"url":"https://api.github.com/repos/kzantow/jenkins","forks_url":"https://api.github.com/repos/kzantow/jenkins/forks","keys_url":"https://api.github.com/repos/kzantow/jenkins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kzantow/jenkins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kzantow/jenkins/teams","hooks_url":"https://api.github.com/repos/kzantow/jenkins/hooks","issue_events_url":"https://api.github.com/repos/kzantow/jenkins/issues/events{/number}","events_url":"https://api.github.com/repos/kzantow/jenkins/events","assignees_url":"https://api.github.com/repos/kzantow/jenkins/assignees{/user}","branches_url":"https://api.github.com/repos/kzantow/jenkins/branches{/branch}","tags_url":"https://api.github.com/repos/kzantow/jenkins/tags","blobs_url":"https://api.github.com/repos/kzantow/jenkins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kzantow/jenkins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kzantow/jenkins/git/refs{/sha}","trees_url":"https://api.github.com/repos/kzantow/jenkins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kzantow/jenkins/statuses/{sha}","languages_url":"https://api.github.com/repos/kzantow/jenkins/languages","stargazers_url":"https://api.github.com/repos/kzantow/jenkins/stargazers","contributors_url":"https://api.github.com/repos/kzantow/jenkins/contributors","subscribers_url":"https://api.github.com/repos/kzantow/jenkins/subscribers","subscription_url":"https://api.github.com/repos/kzantow/jenkins/subscription","commits_url":"https://api.github.com/repos/kzantow/jenkins/commits{/sha}","git_commits_url":"https://api.github.com/repos/kzantow/jenkins/git/commits{/sha}","comments_url":"https://api.github.com/repos/kzantow/jenkins/comments{/number}","issue_comment_url":"https://api.github.com/repos/kzantow/jenkins/issues/comments{/number}","contents_url":"https://api.github.com/repos/kzantow/jenkins/contents/{+path}","compare_url":"https://api.github.com/repos/kzantow/jenkins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kzantow/jenkins/merges","archive_url":"https://api.github.com/repos/kzantow/jenkins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kzantow/jenkins/downloads","issues_url":"https://api.github.com/repos/kzantow/jenkins/issues{/number}","pulls_url":"https://api.github.com/repos/kzantow/jenkins/pulls{/number}","milestones_url":"https://api.github.com/repos/kzantow/jenkins/milestones{/number}","notifications_url":"https://api.github.com/repos/kzantow/jenkins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kzantow/jenkins/labels{/name}","releases_url":"https://api.github.com/repos/kzantow/jenkins/releases{/id}","deployments_url":"https://api.github.com/repos/kzantow/jenkins/deployments","created_at":"2015-08-25T15:52:29Z","updated_at":"2015-08-25T15:52:51Z","pushed_at":"2016-03-06T00:22:07Z","git_url":"git://github.com/kzantow/jenkins.git","ssh_url":"git@github.com:kzantow/jenkins.git","clone_url":"https://github.com/kzantow/jenkins.git","svn_url":"https://github.com/kzantow/jenkins","homepage":"http://jenkins-ci.org/","size":90827,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"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":"jenkinsci:2.0","ref":"2.0","sha":"ecf9e3b8b2d91a6bfce160f223b4a32fe29b27da","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":1103607,"name":"jenkins","full_name":"jenkinsci/jenkins","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/jenkins","description":"Jenkins Continuous Integration Server","fork":true,"url":"https://api.github.com/repos/jenkinsci/jenkins","forks_url":"https://api.github.com/repos/jenkinsci/jenkins/forks","keys_url":"https://api.github.com/repos/jenkinsci/jenkins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/jenkins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/jenkins/teams","hooks_url":"https://api.github.com/repos/jenkinsci/jenkins/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/jenkins/events","assignees_url":"https://api.github.com/repos/jenkinsci/jenkins/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/jenkins/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/jenkins/tags","blobs_url":"https://api.github.com/repos/jenkinsci/jenkins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/jenkins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/jenkins/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/jenkins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/jenkins/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/jenkins/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/jenkins/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/jenkins/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/jenkins/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/jenkins/subscription","commits_url":"https://api.github.com/repos/jenkinsci/jenkins/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/jenkins/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/jenkins/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/jenkins/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/jenkins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/jenkins/merges","archive_url":"https://api.github.com/repos/jenkinsci/jenkins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/jenkins/downloads","issues_url":"https://api.github.com/repos/jenkinsci/jenkins/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/jenkins/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/jenkins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/jenkins/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/jenkins/releases{/id}","deployments_url":"https://api.github.com/repos/jenkinsci/jenkins/deployments","created_at":"2010-11-22T21:21:23Z","updated_at":"2016-03-07T17:44:42Z","pushed_at":"2016-03-07T17:54:13Z","git_url":"git://github.com/jenkinsci/jenkins.git","ssh_url":"git@github.com:jenkinsci/jenkins.git","clone_url":"https://github.com/jenkinsci/jenkins.git","svn_url":"https://github.com/jenkinsci/jenkins","homepage":"http://jenkins-ci.org/","size":96351,"stargazers_count":5250,"watchers_count":5250,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":2330,"mirror_url":null,"open_issues_count":141,"forks":2330,"open_issues":141,"watchers":5250,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/2042"},"html":{"href":"https://github.com/jenkinsci/jenkins/pull/2042"},"issue":{"href":"https://api.github.com/repos/jenkinsci/jenkins/issues/2042"},"comments":{"href":"https://api.github.com/repos/jenkinsci/jenkins/issues/2042/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/2042/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/2042/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/jenkins/statuses/08b6ff33687883d90b22ec83c385713afe3c6adf"}}}}