{"action":"created","comment":{"url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/comments/200171073","pull_request_review_id":134434927,"id":200171073,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDE3MTA3Mw==","diff_hunk":"@@ -1,19 +1,25 @@\n package com.gu.identity\n \n-import com.gu.identity.cookie.{IdentityCookieDecoder, PreProductionKeys}\n+import com.gu.identity.cookie.{IdentityCookieDecoder, PreProductionKeys, ProductionKeys}\n import com.gu.util.Logging\n import com.gu.util.apigateway.ApiGatewayResponse._\n+import com.gu.util.config.Stage\n import com.gu.util.reader.Types._\n \n object IdentityCookieToIdentityId extends Logging {\n \n-  def apply(headersOption: Option[Map[String, String]]): ApiGatewayOp[String] = for {\n-    headers <- headersOption.toApiGatewayContinueProcessing(badRequest, \"no headers\")\n-    cookieHeader <- headers.get(\"Cookie\").toApiGatewayContinueProcessing(badRequest, \"no cookie\")\n-    scGuU <- extractCookieHeaderValue(cookieHeader, \"SC_GU_U\")\n-    cookieDecoder = new IdentityCookieDecoder(new PreProductionKeys) // TODO review keys selection\n-    userFromScGuU <- cookieDecoder.getUserDataForScGuU(scGuU).toApiGatewayContinueProcessing(unauthorized)\n-  } yield userFromScGuU.getId\n+  def apply(headersOption: Option[Map[String, String]], stage: Stage): ApiGatewayOp[String] = {\n+\n+    lazy val keys = if(stage.isProd) new ProductionKeys else new PreProductionKeys","path":"handlers/cancellation-sf-cases/src/main/scala/com/gu/identity/IdentityCookieToIdentityId.scala","position":21,"original_position":21,"commit_id":"cee100be3dcec88e551babcd7af9f63bb23d0a63","original_commit_id":"cee100be3dcec88e551babcd7af9f63bb23d0a63","user":{"login":"johnduffell","id":7304387,"node_id":"MDQ6VXNlcjczMDQzODc=","avatar_url":"https://avatars1.githubusercontent.com/u/7304387?v=4","gravatar_id":"","url":"https://api.github.com/users/johnduffell","html_url":"https://github.com/johnduffell","followers_url":"https://api.github.com/users/johnduffell/followers","following_url":"https://api.github.com/users/johnduffell/following{/other_user}","gists_url":"https://api.github.com/users/johnduffell/gists{/gist_id}","starred_url":"https://api.github.com/users/johnduffell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnduffell/subscriptions","organizations_url":"https://api.github.com/users/johnduffell/orgs","repos_url":"https://api.github.com/users/johnduffell/repos","events_url":"https://api.github.com/users/johnduffell/events{/privacy}","received_events_url":"https://api.github.com/users/johnduffell/received_events","type":"User","site_admin":false},"body":"no reason not to do this on the for comprehension between lines 18 and 19","created_at":"2018-07-04T16:28:27Z","updated_at":"2018-07-04T16:28:28Z","html_url":"https://github.com/guardian/zuora-auto-cancel/pull/130#discussion_r200171073","pull_request_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/130","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/comments/200171073"},"html":{"href":"https://github.com/guardian/zuora-auto-cancel/pull/130#discussion_r200171073"},"pull_request":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/130"}}},"pull_request":{"url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/130","id":199246900,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5MjQ2OTAw","html_url":"https://github.com/guardian/zuora-auto-cancel/pull/130","diff_url":"https://github.com/guardian/zuora-auto-cancel/pull/130.diff","patch_url":"https://github.com/guardian/zuora-auto-cancel/pull/130.patch","issue_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/130","number":130,"state":"open","locked":false,"title":"Identity Cookie Decoding now uses environment specific keys","user":{"login":"twrichards","id":19289579,"node_id":"MDQ6VXNlcjE5Mjg5NTc5","avatar_url":"https://avatars2.githubusercontent.com/u/19289579?v=4","gravatar_id":"","url":"https://api.github.com/users/twrichards","html_url":"https://github.com/twrichards","followers_url":"https://api.github.com/users/twrichards/followers","following_url":"https://api.github.com/users/twrichards/following{/other_user}","gists_url":"https://api.github.com/users/twrichards/gists{/gist_id}","starred_url":"https://api.github.com/users/twrichards/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twrichards/subscriptions","organizations_url":"https://api.github.com/users/twrichards/orgs","repos_url":"https://api.github.com/users/twrichards/repos","events_url":"https://api.github.com/users/twrichards/events{/privacy}","received_events_url":"https://api.github.com/users/twrichards/received_events","type":"User","site_admin":false},"body":"The 'stage' is now passed into the identity cookie checking to determine whether to use `ProductionKeys` or `PreProductionKeys` for decoding the cookie (in order to extract the identity id).","created_at":"2018-07-04T13:17:03Z","updated_at":"2018-07-04T16:28:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"38d53396628b372d272e78865ef855927eaf0790","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/130/commits","review_comments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/130/comments","review_comment_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/130/comments","statuses_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/statuses/cee100be3dcec88e551babcd7af9f63bb23d0a63","head":{"label":"guardian:cancellation-sf-cases","ref":"cancellation-sf-cases","sha":"cee100be3dcec88e551babcd7af9f63bb23d0a63","user":{"login":"guardian","id":164318,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDMxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":80627505,"node_id":"MDEwOlJlcG9zaXRvcnk4MDYyNzUwNQ==","name":"zuora-auto-cancel","full_name":"guardian/zuora-auto-cancel","owner":{"login":"guardian","id":164318,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDMxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/zuora-auto-cancel","description":"Lambdas covering supporter operations, mostly in life operations","fork":false,"url":"https://api.github.com/repos/guardian/zuora-auto-cancel","forks_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/forks","keys_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/teams","hooks_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/hooks","issue_events_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/events","assignees_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/tags","blobs_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/languages","stargazers_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/stargazers","contributors_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/contributors","subscribers_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/subscribers","subscription_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/subscription","commits_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/merges","archive_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/downloads","issues_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/labels{/name}","releases_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/deployments","created_at":"2017-02-01T14:25:47Z","updated_at":"2018-07-04T10:52:40Z","pushed_at":"2018-07-04T13:51:51Z","git_url":"git://github.com/guardian/zuora-auto-cancel.git","ssh_url":"git@github.com:guardian/zuora-auto-cancel.git","clone_url":"https://github.com/guardian/zuora-auto-cancel.git","svn_url":"https://github.com/guardian/zuora-auto-cancel","homepage":"","size":1351,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":2,"open_issues":2,"watchers":3,"default_branch":"master"}},"base":{"label":"guardian:master","ref":"master","sha":"2c72bd8e6b07a0787015b13bfa231af82c16f605","user":{"login":"guardian","id":164318,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDMxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"repo":{"id":80627505,"node_id":"MDEwOlJlcG9zaXRvcnk4MDYyNzUwNQ==","name":"zuora-auto-cancel","full_name":"guardian/zuora-auto-cancel","owner":{"login":"guardian","id":164318,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDMxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/164318?v=4","gravatar_id":"","url":"https://api.github.com/users/guardian","html_url":"https://github.com/guardian","followers_url":"https://api.github.com/users/guardian/followers","following_url":"https://api.github.com/users/guardian/following{/other_user}","gists_url":"https://api.github.com/users/guardian/gists{/gist_id}","starred_url":"https://api.github.com/users/guardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardian/subscriptions","organizations_url":"https://api.github.com/users/guardian/orgs","repos_url":"https://api.github.com/users/guardian/repos","events_url":"https://api.github.com/users/guardian/events{/privacy}","received_events_url":"https://api.github.com/users/guardian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/guardian/zuora-auto-cancel","description":"Lambdas covering supporter operations, mostly in life operations","fork":false,"url":"https://api.github.com/repos/guardian/zuora-auto-cancel","forks_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/forks","keys_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/teams","hooks_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/hooks","issue_events_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/events{/number}","events_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/events","assignees_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/assignees{/user}","branches_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/branches{/branch}","tags_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/tags","blobs_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/refs{/sha}","trees_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/statuses/{sha}","languages_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/languages","stargazers_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/stargazers","contributors_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/contributors","subscribers_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/subscribers","subscription_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/subscription","commits_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/commits{/sha}","git_commits_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/git/commits{/sha}","comments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/comments{/number}","issue_comment_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/comments{/number}","contents_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/contents/{+path}","compare_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/merges","archive_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/downloads","issues_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues{/number}","pulls_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls{/number}","milestones_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/milestones{/number}","notifications_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/labels{/name}","releases_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/releases{/id}","deployments_url":"https://api.github.com/repos/guardian/zuora-auto-cancel/deployments","created_at":"2017-02-01T14:25:47Z","updated_at":"2018-07-04T10:52:40Z","pushed_at":"2018-07-04T13:51:51Z","git_url":"git://github.com/guardian/zuora-auto-cancel.git","ssh_url":"git@github.com:guardian/zuora-auto-cancel.git","clone_url":"https://github.com/guardian/zuora-auto-cancel.git","svn_url":"https://github.com/guardian/zuora-auto-cancel","homepage":"","size":1351,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":2,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/130"},"html":{"href":"https://github.com/guardian/zuora-auto-cancel/pull/130"},"issue":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/130"},"comments":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/issues/130/comments"},"review_comments":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/130/comments"},"review_comment":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/pulls/130/commits"},"statuses":{"href":"https://api.github.com/repos/guardian/zuora-auto-cancel/statuses/cee100be3dcec88e551babcd7af9f63bb23d0a63"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"johnduffell"}}