{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/comments/39253141","id":39253141,"diff_hunk":"@@ -240,6 +258,49 @@\n         });\n     }\n \n+    @Issue(\"JENKINS-30326\")\n+    @Test\n+    public void testGlobalBindingWithAuthorization() {\n+        story.addStep(new Statement() {\n+            @Override public void evaluate() throws Throwable {\n+                // configure security\n+                story.j.jenkins.setSecurityRealm(story.j.createDummySecurityRealm());\n+                story.j.jenkins.setAuthorizationStrategy(new FullControlOnceLoggedInAuthorizationStrategy());\n+                // create the user.\n+                story.j.jenkins.getUser(\"dummy\");\n+                \n+                // enable the run as user strategy for the AuthorizeProject plugin\n+                Map<String, Boolean> strategies = new HashMap<String, Boolean>();\n+                strategies.put(story.j.jenkins.getDescriptor(SpecificUsersAuthorizationStrategy.class).getId(), true);\n+                QueueItemAuthenticatorConfiguration.get().getAuthenticators().add(new ProjectQueueItemAuthenticator(strategies));\n+\n+                // blanket whitelist all methods (easier than whitelisting Jenkins.getAuthentication)\n+                story.j.jenkins.getExtensionList(Whitelist.class).add(new BlanketWhitelist());\n+\n+                String credentialsId = \"creds\";\n+                String secret = \"s3cr3t\";\n+                CredentialsProvider.lookupStores(story.j.jenkins).iterator().next().addCredentials(Domain.global(), new StringCredentialsImpl(CredentialsScope.GLOBAL, credentialsId, \"sample\", Secret.fromString(secret)));\n+                WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, \"p\");\n+\n+                p.setDefinition(new CpsFlowDefinition(\"\"\n+                        + \"node {\\n\"\n+                        + \"  def authentication = Jenkins.getAuthentication()\\n\"\n+                        + \"  echo \\\"running as user: $authentication.principal\\\"\\n\"\n+                        + \"  withCredentials([[$class: 'StringBinding', credentialsId: '\" + credentialsId + \"', variable: 'SECRET']]) {\\n\"\n+                        + \"    echo 'this will fail if the credentials can not be found'\\n\"\n+                        + \"  }\\n\"\n+                        + \"}\", true));\n+                // run the job as a specific user\n+                p.addProperty(new AuthorizeProjectProperty(new SpecificUsersAuthorizationStrategy(\"dummy\", true)));\n+\n+                // the build will fail if we can not locate the credentials\n+                WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0).get());\n+                // make sure this was actually run as a user and not system\n+                story.j.assertLogContains(\"running as user: dummy\", b);\n+            }","path":"src/test/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStepTest.java","position":99,"original_position":99,"commit_id":"f49f23fbc0604674a3080d3d5e1ab51e7d7dc11d","original_commit_id":"f49f23fbc0604674a3080d3d5e1ab51e7d7dc11d","user":{"login":"tfennelly","id":429311,"avatar_url":"https://avatars.githubusercontent.com/u/429311?v=3","gravatar_id":"","url":"https://api.github.com/users/tfennelly","html_url":"https://github.com/tfennelly","followers_url":"https://api.github.com/users/tfennelly/followers","following_url":"https://api.github.com/users/tfennelly/following{/other_user}","gists_url":"https://api.github.com/users/tfennelly/gists{/gist_id}","starred_url":"https://api.github.com/users/tfennelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfennelly/subscriptions","organizations_url":"https://api.github.com/users/tfennelly/orgs","repos_url":"https://api.github.com/users/tfennelly/repos","events_url":"https://api.github.com/users/tfennelly/events{/privacy}","received_events_url":"https://api.github.com/users/tfennelly/received_events","type":"User","site_admin":false},"body":"Should it be testing for the `echo`d text from inside the `withCredentials` closure?","created_at":"2015-09-11T09:02:54Z","updated_at":"2015-09-11T09:02:54Z","html_url":"https://github.com/jenkinsci/credentials-binding-plugin/pull/8#discussion_r39253141","pull_request_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/comments/39253141"},"html":{"href":"https://github.com/jenkinsci/credentials-binding-plugin/pull/8#discussion_r39253141"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/8","id":44691425,"html_url":"https://github.com/jenkinsci/credentials-binding-plugin/pull/8","diff_url":"https://github.com/jenkinsci/credentials-binding-plugin/pull/8.diff","patch_url":"https://github.com/jenkinsci/credentials-binding-plugin/pull/8.patch","issue_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/issues/8","number":8,"state":"open","locked":false,"title":"Jenkins 30326","user":{"login":"jtnord","id":494726,"avatar_url":"https://avatars.githubusercontent.com/u/494726?v=3","gravatar_id":"","url":"https://api.github.com/users/jtnord","html_url":"https://github.com/jtnord","followers_url":"https://api.github.com/users/jtnord/followers","following_url":"https://api.github.com/users/jtnord/following{/other_user}","gists_url":"https://api.github.com/users/jtnord/gists{/gist_id}","starred_url":"https://api.github.com/users/jtnord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtnord/subscriptions","organizations_url":"https://api.github.com/users/jtnord/orgs","repos_url":"https://api.github.com/users/jtnord/repos","events_url":"https://api.github.com/users/jtnord/events{/privacy}","received_events_url":"https://api.github.com/users/jtnord/received_events","type":"User","site_admin":false},"body":"added a test case for [JENKINS-30326](https://issues.jenkins-ci.org/browse/JENKINS-30326) and up the dependency to pull in the fix.\r\n\r\n@reviewbybees -esp @jglick ","created_at":"2015-09-10T16:47:06Z","updated_at":"2015-09-11T09:02:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9375df1db70bd851a1f96b7e1bfaec4876c81b34","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/8/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/8/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/issues/8/comments","statuses_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/statuses/f49f23fbc0604674a3080d3d5e1ab51e7d7dc11d","head":{"label":"jtnord:jenkins-30326","ref":"jenkins-30326","sha":"f49f23fbc0604674a3080d3d5e1ab51e7d7dc11d","user":{"login":"jtnord","id":494726,"avatar_url":"https://avatars.githubusercontent.com/u/494726?v=3","gravatar_id":"","url":"https://api.github.com/users/jtnord","html_url":"https://github.com/jtnord","followers_url":"https://api.github.com/users/jtnord/followers","following_url":"https://api.github.com/users/jtnord/following{/other_user}","gists_url":"https://api.github.com/users/jtnord/gists{/gist_id}","starred_url":"https://api.github.com/users/jtnord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtnord/subscriptions","organizations_url":"https://api.github.com/users/jtnord/orgs","repos_url":"https://api.github.com/users/jtnord/repos","events_url":"https://api.github.com/users/jtnord/events{/privacy}","received_events_url":"https://api.github.com/users/jtnord/received_events","type":"User","site_admin":false},"repo":{"id":42240712,"name":"credentials-binding-plugin","full_name":"jtnord/credentials-binding-plugin","owner":{"login":"jtnord","id":494726,"avatar_url":"https://avatars.githubusercontent.com/u/494726?v=3","gravatar_id":"","url":"https://api.github.com/users/jtnord","html_url":"https://github.com/jtnord","followers_url":"https://api.github.com/users/jtnord/followers","following_url":"https://api.github.com/users/jtnord/following{/other_user}","gists_url":"https://api.github.com/users/jtnord/gists{/gist_id}","starred_url":"https://api.github.com/users/jtnord/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtnord/subscriptions","organizations_url":"https://api.github.com/users/jtnord/orgs","repos_url":"https://api.github.com/users/jtnord/repos","events_url":"https://api.github.com/users/jtnord/events{/privacy}","received_events_url":"https://api.github.com/users/jtnord/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jtnord/credentials-binding-plugin","description":"","fork":true,"url":"https://api.github.com/repos/jtnord/credentials-binding-plugin","forks_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/forks","keys_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/teams","hooks_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/hooks","issue_events_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/events","assignees_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/tags","blobs_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/languages","stargazers_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/stargazers","contributors_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/contributors","subscribers_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/subscribers","subscription_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/subscription","commits_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/merges","archive_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/downloads","issues_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jtnord/credentials-binding-plugin/releases{/id}","created_at":"2015-09-10T11:33:14Z","updated_at":"2015-09-10T11:33:15Z","pushed_at":"2015-09-10T16:46:14Z","git_url":"git://github.com/jtnord/credentials-binding-plugin.git","ssh_url":"git@github.com:jtnord/credentials-binding-plugin.git","clone_url":"https://github.com/jtnord/credentials-binding-plugin.git","svn_url":"https://github.com/jtnord/credentials-binding-plugin","homepage":"","size":167,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"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:master","ref":"master","sha":"781a9148e9b06e6f13f6f2e03d160ce21f4ddefe","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":13251519,"name":"credentials-binding-plugin","full_name":"jenkinsci/credentials-binding-plugin","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/credentials-binding-plugin","description":"","fork":false,"url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin","forks_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/releases{/id}","created_at":"2013-10-01T18:18:46Z","updated_at":"2015-08-20T19:22:24Z","pushed_at":"2015-09-10T16:47:06Z","git_url":"git://github.com/jenkinsci/credentials-binding-plugin.git","ssh_url":"git@github.com:jenkinsci/credentials-binding-plugin.git","clone_url":"https://github.com/jenkinsci/credentials-binding-plugin.git","svn_url":"https://github.com/jenkinsci/credentials-binding-plugin","homepage":"","size":377,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":1,"forks":9,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/8"},"html":{"href":"https://github.com/jenkinsci/credentials-binding-plugin/pull/8"},"issue":{"href":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/issues/8"},"comments":{"href":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/credentials-binding-plugin/statuses/f49f23fbc0604674a3080d3d5e1ab51e7d7dc11d"}}}}