{"action":"created","comment":{"url":"https://api.github.com/repos/rackerlabs/repose/pulls/comments/27486337","id":27486337,"diff_hunk":"@@ -120,4 +127,73 @@ class PassClientDefaulRegionInHeaderTest extends ReposeValveTest {\n         request2.headers.getFirstValue(\"X-Default-Region\") == \"the-default-region\"\n \n     }\n+\n+    def \"when a token is validated, repose should pass the contactID attribute as X-Contact-ID\"() {\n+        when: \"I send a GET request to Repose with an X-Auth-Token header\"\n+        fakeIdentityService.with {\n+            client_token = \"racker457\"\n+            tokenExpiresAt = DateTime.now().plusDays(1)\n+            client_userid = \"457\"\n+            contact_id = \"the-contactID\"\n+        }\n+        fakeIdentityService.resetCounts()\n+        MessageChain mc = deproxy.makeRequest(url: reposeEndpoint, method: 'GET', headers: ['X-Auth-Token': fakeIdentityService.client_token])\n+\n+        then: \"Repose should validate the token and pass the user's contact ID as the X-ContactID header to the origin service\"\n+        mc.receivedResponse.code == \"200\"\n+        fakeIdentityService.validateTokenCount == 1\n+        mc.handlings.size() == 1\n+        mc.handlings[0].endpoint == originEndpoint\n+        def request = mc.handlings[0].request\n+        request.headers.contains(\"X-Contact-ID\")\n+        request.headers.getFirstValue(\"X-Contact-ID\") == \"the-contactID\"\n+\n+        when: \"I send a second GET request to Repose with the same token\"\n+        fakeIdentityService.resetCounts()\n+        mc = deproxy.makeRequest(url: reposeEndpoint, method: 'GET', headers: ['X-Auth-Token': fakeIdentityService.client_token])\n+\n+        then: \"Repose should use the cache, not call out to the fake identity service, and pass the request to origin service with the same X-ContactID header\"\n+        mc.receivedResponse.code == \"200\"\n+        fakeIdentityService.validateTokenCount == 0\n+        mc.handlings.size() == 1\n+        mc.handlings[0].endpoint == originEndpoint\n+        def request2 = mc.handlings[0].request\n+        request2.headers.contains(\"X-Contact-ID\")\n+        request2.headers.getFirstValue(\"X-Contact-ID\") == \"the-contactID\"\n+\n+    }\n+\n+    def \"when a token is validated and contactID does not exist in response, X-Contact-ID should not be passed in\"() {","path":"repose-aggregator/functional-tests/spock-functional-test/src/test/groovy/features/filters/clientauthn/userAttributeHeaders/PassUserAttributesInHeaderTest.groovy","position":86,"original_position":86,"commit_id":"53210bf4813ebf0ed861290475ef33829a452f01","original_commit_id":"53210bf4813ebf0ed861290475ef33829a452f01","user":{"login":"wdschei","id":7366196,"avatar_url":"https://avatars.githubusercontent.com/u/7366196?v=3","gravatar_id":"","url":"https://api.github.com/users/wdschei","html_url":"https://github.com/wdschei","followers_url":"https://api.github.com/users/wdschei/followers","following_url":"https://api.github.com/users/wdschei/following{/other_user}","gists_url":"https://api.github.com/users/wdschei/gists{/gist_id}","starred_url":"https://api.github.com/users/wdschei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wdschei/subscriptions","organizations_url":"https://api.github.com/users/wdschei/orgs","repos_url":"https://api.github.com/users/wdschei/repos","events_url":"https://api.github.com/users/wdschei/events{/privacy}","received_events_url":"https://api.github.com/users/wdschei/received_events","type":"User","site_admin":false},"body":"To bad this wasn't a Spock test, this would have been a nice Unroll.","created_at":"2015-03-31T14:54:38Z","updated_at":"2015-03-31T14:54:38Z","html_url":"https://github.com/rackerlabs/repose/pull/1277#discussion_r27486337","pull_request_url":"https://api.github.com/repos/rackerlabs/repose/pulls/1277","_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/repose/pulls/comments/27486337"},"html":{"href":"https://github.com/rackerlabs/repose/pull/1277#discussion_r27486337"},"pull_request":{"href":"https://api.github.com/repos/rackerlabs/repose/pulls/1277"}}},"pull_request":{"url":"https://api.github.com/repos/rackerlabs/repose/pulls/1277","id":32247995,"html_url":"https://github.com/rackerlabs/repose/pull/1277","diff_url":"https://github.com/rackerlabs/repose/pull/1277.diff","patch_url":"https://github.com/rackerlabs/repose/pull/1277.patch","issue_url":"https://api.github.com/repos/rackerlabs/repose/issues/1277","number":1277,"state":"open","locked":false,"title":"Rep 1838 Contact ID header population added to auth-n filter","user":{"login":"adrianjgeorge","id":997130,"avatar_url":"https://avatars.githubusercontent.com/u/997130?v=3","gravatar_id":"","url":"https://api.github.com/users/adrianjgeorge","html_url":"https://github.com/adrianjgeorge","followers_url":"https://api.github.com/users/adrianjgeorge/followers","following_url":"https://api.github.com/users/adrianjgeorge/following{/other_user}","gists_url":"https://api.github.com/users/adrianjgeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/adrianjgeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrianjgeorge/subscriptions","organizations_url":"https://api.github.com/users/adrianjgeorge/orgs","repos_url":"https://api.github.com/users/adrianjgeorge/repos","events_url":"https://api.github.com/users/adrianjgeorge/events{/privacy}","received_events_url":"https://api.github.com/users/adrianjgeorge/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-30T17:24:20Z","updated_at":"2015-03-31T14:54:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2071d9f0d4dea023aa67fe00178892a4f65d1117","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rackerlabs/repose/pulls/1277/commits","review_comments_url":"https://api.github.com/repos/rackerlabs/repose/pulls/1277/comments","review_comment_url":"https://api.github.com/repos/rackerlabs/repose/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rackerlabs/repose/issues/1277/comments","statuses_url":"https://api.github.com/repos/rackerlabs/repose/statuses/53210bf4813ebf0ed861290475ef33829a452f01","head":{"label":"rackerlabs:REP-1838_auth_contentID","ref":"REP-1838_auth_contentID","sha":"53210bf4813ebf0ed861290475ef33829a452f01","user":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":1981821,"name":"repose","full_name":"rackerlabs/repose","owner":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackerlabs/repose","description":"The powerful, programmable, API Middleware Platform","fork":false,"url":"https://api.github.com/repos/rackerlabs/repose","forks_url":"https://api.github.com/repos/rackerlabs/repose/forks","keys_url":"https://api.github.com/repos/rackerlabs/repose/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackerlabs/repose/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackerlabs/repose/teams","hooks_url":"https://api.github.com/repos/rackerlabs/repose/hooks","issue_events_url":"https://api.github.com/repos/rackerlabs/repose/issues/events{/number}","events_url":"https://api.github.com/repos/rackerlabs/repose/events","assignees_url":"https://api.github.com/repos/rackerlabs/repose/assignees{/user}","branches_url":"https://api.github.com/repos/rackerlabs/repose/branches{/branch}","tags_url":"https://api.github.com/repos/rackerlabs/repose/tags","blobs_url":"https://api.github.com/repos/rackerlabs/repose/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackerlabs/repose/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackerlabs/repose/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackerlabs/repose/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackerlabs/repose/statuses/{sha}","languages_url":"https://api.github.com/repos/rackerlabs/repose/languages","stargazers_url":"https://api.github.com/repos/rackerlabs/repose/stargazers","contributors_url":"https://api.github.com/repos/rackerlabs/repose/contributors","subscribers_url":"https://api.github.com/repos/rackerlabs/repose/subscribers","subscription_url":"https://api.github.com/repos/rackerlabs/repose/subscription","commits_url":"https://api.github.com/repos/rackerlabs/repose/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackerlabs/repose/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackerlabs/repose/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackerlabs/repose/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackerlabs/repose/contents/{+path}","compare_url":"https://api.github.com/repos/rackerlabs/repose/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackerlabs/repose/merges","archive_url":"https://api.github.com/repos/rackerlabs/repose/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackerlabs/repose/downloads","issues_url":"https://api.github.com/repos/rackerlabs/repose/issues{/number}","pulls_url":"https://api.github.com/repos/rackerlabs/repose/pulls{/number}","milestones_url":"https://api.github.com/repos/rackerlabs/repose/milestones{/number}","notifications_url":"https://api.github.com/repos/rackerlabs/repose/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackerlabs/repose/labels{/name}","releases_url":"https://api.github.com/repos/rackerlabs/repose/releases{/id}","created_at":"2011-07-01T04:39:34Z","updated_at":"2015-03-31T12:22:21Z","pushed_at":"2015-03-31T12:22:22Z","git_url":"git://github.com/rackerlabs/repose.git","ssh_url":"git@github.com:rackerlabs/repose.git","clone_url":"https://github.com/rackerlabs/repose.git","svn_url":"https://github.com/rackerlabs/repose","homepage":"http://www.openrepose.org/","size":117728,"stargazers_count":181,"watchers_count":181,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":52,"mirror_url":null,"open_issues_count":5,"forks":52,"open_issues":5,"watchers":181,"default_branch":"master"}},"base":{"label":"rackerlabs:master","ref":"master","sha":"9bafba8c875a203805135af5bd4949b01af74bc0","user":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":1981821,"name":"repose","full_name":"rackerlabs/repose","owner":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackerlabs/repose","description":"The powerful, programmable, API Middleware Platform","fork":false,"url":"https://api.github.com/repos/rackerlabs/repose","forks_url":"https://api.github.com/repos/rackerlabs/repose/forks","keys_url":"https://api.github.com/repos/rackerlabs/repose/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackerlabs/repose/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackerlabs/repose/teams","hooks_url":"https://api.github.com/repos/rackerlabs/repose/hooks","issue_events_url":"https://api.github.com/repos/rackerlabs/repose/issues/events{/number}","events_url":"https://api.github.com/repos/rackerlabs/repose/events","assignees_url":"https://api.github.com/repos/rackerlabs/repose/assignees{/user}","branches_url":"https://api.github.com/repos/rackerlabs/repose/branches{/branch}","tags_url":"https://api.github.com/repos/rackerlabs/repose/tags","blobs_url":"https://api.github.com/repos/rackerlabs/repose/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackerlabs/repose/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackerlabs/repose/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackerlabs/repose/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackerlabs/repose/statuses/{sha}","languages_url":"https://api.github.com/repos/rackerlabs/repose/languages","stargazers_url":"https://api.github.com/repos/rackerlabs/repose/stargazers","contributors_url":"https://api.github.com/repos/rackerlabs/repose/contributors","subscribers_url":"https://api.github.com/repos/rackerlabs/repose/subscribers","subscription_url":"https://api.github.com/repos/rackerlabs/repose/subscription","commits_url":"https://api.github.com/repos/rackerlabs/repose/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackerlabs/repose/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackerlabs/repose/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackerlabs/repose/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackerlabs/repose/contents/{+path}","compare_url":"https://api.github.com/repos/rackerlabs/repose/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackerlabs/repose/merges","archive_url":"https://api.github.com/repos/rackerlabs/repose/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackerlabs/repose/downloads","issues_url":"https://api.github.com/repos/rackerlabs/repose/issues{/number}","pulls_url":"https://api.github.com/repos/rackerlabs/repose/pulls{/number}","milestones_url":"https://api.github.com/repos/rackerlabs/repose/milestones{/number}","notifications_url":"https://api.github.com/repos/rackerlabs/repose/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackerlabs/repose/labels{/name}","releases_url":"https://api.github.com/repos/rackerlabs/repose/releases{/id}","created_at":"2011-07-01T04:39:34Z","updated_at":"2015-03-31T12:22:21Z","pushed_at":"2015-03-31T12:22:22Z","git_url":"git://github.com/rackerlabs/repose.git","ssh_url":"git@github.com:rackerlabs/repose.git","clone_url":"https://github.com/rackerlabs/repose.git","svn_url":"https://github.com/rackerlabs/repose","homepage":"http://www.openrepose.org/","size":117728,"stargazers_count":181,"watchers_count":181,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":52,"mirror_url":null,"open_issues_count":5,"forks":52,"open_issues":5,"watchers":181,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/repose/pulls/1277"},"html":{"href":"https://github.com/rackerlabs/repose/pull/1277"},"issue":{"href":"https://api.github.com/repos/rackerlabs/repose/issues/1277"},"comments":{"href":"https://api.github.com/repos/rackerlabs/repose/issues/1277/comments"},"review_comments":{"href":"https://api.github.com/repos/rackerlabs/repose/pulls/1277/comments"},"review_comment":{"href":"https://api.github.com/repos/rackerlabs/repose/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rackerlabs/repose/pulls/1277/commits"},"statuses":{"href":"https://api.github.com/repos/rackerlabs/repose/statuses/53210bf4813ebf0ed861290475ef33829a452f01"}}}}