{"action":"created","comment":{"url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/comments/109165234","pull_request_review_id":30251568,"id":109165234,"diff_hunk":"@@ -0,0 +1,94 @@\n+package com.ovoenergy.event.gateway.manager.api.resources\n+\n+import java.util.concurrent.TimeUnit\n+\n+import akka.event.Logging\n+import akka.http.scaladsl.model.StatusCodes.{BadRequest, Forbidden, NotFound, OK}\n+import akka.http.scaladsl.server._\n+import akka.stream.Materializer\n+import com.ovoenergy.comms.model.{Gateway, SMSProgressed}\n+import com.ovoenergy.event.gateway.manager.api.resources.logging.ResourceLogger\n+import com.ovoenergy.event.gateway.manager.dynamo.GatewayIdentifier\n+import com.ovoenergy.event.gateway.manager.logging.LoggingWithMDC\n+import com.ovoenergy.event.gateway.manager.twilio.Converters\n+import com.ovoenergy.event.gateway.manager.twilio.SignatureVerification.RequestSignature\n+\n+import scala.concurrent.{ExecutionContext, Future}\n+import scala.concurrent.duration.FiniteDuration\n+\n+class TwilioResource(\n+    verifySignature: (RequestSignature) => Boolean,\n+    getGatewayIdentifier: (GatewayIdentifier.Id) => Option[GatewayIdentifier],\n+    sendSmsProgressedEvent: (SMSProgressed) => Future[_])(implicit ec: ExecutionContext, mat: Materializer)\n+    extends Directives\n+    with LoggingWithMDC {\n+\n+  private def validateSignature: Directive0 = {\n+    (extractRequest & formFieldMap).tflatMap {\n+      case (request, formData) =>\n+        request.headers.find(_.is(\"x-twilio-signature\")) match {\n+          case None => complete(Forbidden -> \"Bad request!\")","path":"src/main/scala/com/ovoenergy/event/gateway/manager/api/resources/TwilioResource.scala","position":30,"original_position":30,"commit_id":"a27aa0ed8bf1a772c1e7bd5c42a41b52c708eb56","original_commit_id":"a27aa0ed8bf1a772c1e7bd5c42a41b52c708eb56","user":{"login":"fleetwoods","id":6851164,"avatar_url":"https://avatars3.githubusercontent.com/u/6851164?v=3","gravatar_id":"","url":"https://api.github.com/users/fleetwoods","html_url":"https://github.com/fleetwoods","followers_url":"https://api.github.com/users/fleetwoods/followers","following_url":"https://api.github.com/users/fleetwoods/following{/other_user}","gists_url":"https://api.github.com/users/fleetwoods/gists{/gist_id}","starred_url":"https://api.github.com/users/fleetwoods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fleetwoods/subscriptions","organizations_url":"https://api.github.com/users/fleetwoods/orgs","repos_url":"https://api.github.com/users/fleetwoods/repos","events_url":"https://api.github.com/users/fleetwoods/events{/privacy}","received_events_url":"https://api.github.com/users/fleetwoods/received_events","type":"User","site_admin":false},"body":"Add some logging around these auth failures","created_at":"2017-03-31T13:56:42Z","updated_at":"2017-03-31T13:56:42Z","html_url":"https://github.com/ovotech/comms-gateway-event-manager/pull/24#discussion_r109165234","pull_request_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/24","_links":{"self":{"href":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/comments/109165234"},"html":{"href":"https://github.com/ovotech/comms-gateway-event-manager/pull/24#discussion_r109165234"},"pull_request":{"href":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/24"}}},"pull_request":{"url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/24","id":113636676,"html_url":"https://github.com/ovotech/comms-gateway-event-manager/pull/24","diff_url":"https://github.com/ovotech/comms-gateway-event-manager/pull/24.diff","patch_url":"https://github.com/ovotech/comms-gateway-event-manager/pull/24.patch","issue_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/issues/24","number":24,"state":"open","locked":false,"title":"Twilio sms","user":{"login":"fleetwoods","id":6851164,"avatar_url":"https://avatars3.githubusercontent.com/u/6851164?v=3","gravatar_id":"","url":"https://api.github.com/users/fleetwoods","html_url":"https://github.com/fleetwoods","followers_url":"https://api.github.com/users/fleetwoods/followers","following_url":"https://api.github.com/users/fleetwoods/following{/other_user}","gists_url":"https://api.github.com/users/fleetwoods/gists{/gist_id}","starred_url":"https://api.github.com/users/fleetwoods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fleetwoods/subscriptions","organizations_url":"https://api.github.com/users/fleetwoods/orgs","repos_url":"https://api.github.com/users/fleetwoods/repos","events_url":"https://api.github.com/users/fleetwoods/events{/privacy}","received_events_url":"https://api.github.com/users/fleetwoods/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-03-31T12:13:56Z","updated_at":"2017-03-31T13:56:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3304a48dc22fd60bed6f5b2d8c26fe569308f914","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/24/commits","review_comments_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/24/comments","review_comment_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/issues/24/comments","statuses_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/statuses/a27aa0ed8bf1a772c1e7bd5c42a41b52c708eb56","head":{"label":"ovotech:twilio-sms","ref":"twilio-sms","sha":"a27aa0ed8bf1a772c1e7bd5c42a41b52c708eb56","user":{"login":"ovotech","id":3543199,"avatar_url":"https://avatars3.githubusercontent.com/u/3543199?v=3","gravatar_id":"","url":"https://api.github.com/users/ovotech","html_url":"https://github.com/ovotech","followers_url":"https://api.github.com/users/ovotech/followers","following_url":"https://api.github.com/users/ovotech/following{/other_user}","gists_url":"https://api.github.com/users/ovotech/gists{/gist_id}","starred_url":"https://api.github.com/users/ovotech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovotech/subscriptions","organizations_url":"https://api.github.com/users/ovotech/orgs","repos_url":"https://api.github.com/users/ovotech/repos","events_url":"https://api.github.com/users/ovotech/events{/privacy}","received_events_url":"https://api.github.com/users/ovotech/received_events","type":"Organization","site_admin":false},"repo":{"id":75288779,"name":"comms-gateway-event-manager","full_name":"ovotech/comms-gateway-event-manager","owner":{"login":"ovotech","id":3543199,"avatar_url":"https://avatars3.githubusercontent.com/u/3543199?v=3","gravatar_id":"","url":"https://api.github.com/users/ovotech","html_url":"https://github.com/ovotech","followers_url":"https://api.github.com/users/ovotech/followers","following_url":"https://api.github.com/users/ovotech/following{/other_user}","gists_url":"https://api.github.com/users/ovotech/gists{/gist_id}","starred_url":"https://api.github.com/users/ovotech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovotech/subscriptions","organizations_url":"https://api.github.com/users/ovotech/orgs","repos_url":"https://api.github.com/users/ovotech/repos","events_url":"https://api.github.com/users/ovotech/events{/privacy}","received_events_url":"https://api.github.com/users/ovotech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ovotech/comms-gateway-event-manager","description":"Handles interaction with 3rd-party comms gateways in order to gather events","fork":false,"url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager","forks_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/forks","keys_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/teams","hooks_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/hooks","issue_events_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/issues/events{/number}","events_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/events","assignees_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/assignees{/user}","branches_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/branches{/branch}","tags_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/tags","blobs_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/languages","stargazers_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/stargazers","contributors_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/contributors","subscribers_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/subscribers","subscription_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/subscription","commits_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/contents/{+path}","compare_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/merges","archive_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/downloads","issues_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/issues{/number}","pulls_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/labels{/name}","releases_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/releases{/id}","deployments_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/deployments","created_at":"2016-12-01T12:05:02Z","updated_at":"2016-12-13T10:50:09Z","pushed_at":"2017-03-31T13:39:07Z","git_url":"git://github.com/ovotech/comms-gateway-event-manager.git","ssh_url":"git@github.com:ovotech/comms-gateway-event-manager.git","clone_url":"https://github.com/ovotech/comms-gateway-event-manager.git","svn_url":"https://github.com/ovotech/comms-gateway-event-manager","homepage":null,"size":165,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ovotech:master","ref":"master","sha":"fe9e6c7e0ce99758b4f8229a92a49e9609159064","user":{"login":"ovotech","id":3543199,"avatar_url":"https://avatars3.githubusercontent.com/u/3543199?v=3","gravatar_id":"","url":"https://api.github.com/users/ovotech","html_url":"https://github.com/ovotech","followers_url":"https://api.github.com/users/ovotech/followers","following_url":"https://api.github.com/users/ovotech/following{/other_user}","gists_url":"https://api.github.com/users/ovotech/gists{/gist_id}","starred_url":"https://api.github.com/users/ovotech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovotech/subscriptions","organizations_url":"https://api.github.com/users/ovotech/orgs","repos_url":"https://api.github.com/users/ovotech/repos","events_url":"https://api.github.com/users/ovotech/events{/privacy}","received_events_url":"https://api.github.com/users/ovotech/received_events","type":"Organization","site_admin":false},"repo":{"id":75288779,"name":"comms-gateway-event-manager","full_name":"ovotech/comms-gateway-event-manager","owner":{"login":"ovotech","id":3543199,"avatar_url":"https://avatars3.githubusercontent.com/u/3543199?v=3","gravatar_id":"","url":"https://api.github.com/users/ovotech","html_url":"https://github.com/ovotech","followers_url":"https://api.github.com/users/ovotech/followers","following_url":"https://api.github.com/users/ovotech/following{/other_user}","gists_url":"https://api.github.com/users/ovotech/gists{/gist_id}","starred_url":"https://api.github.com/users/ovotech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovotech/subscriptions","organizations_url":"https://api.github.com/users/ovotech/orgs","repos_url":"https://api.github.com/users/ovotech/repos","events_url":"https://api.github.com/users/ovotech/events{/privacy}","received_events_url":"https://api.github.com/users/ovotech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ovotech/comms-gateway-event-manager","description":"Handles interaction with 3rd-party comms gateways in order to gather events","fork":false,"url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager","forks_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/forks","keys_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/teams","hooks_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/hooks","issue_events_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/issues/events{/number}","events_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/events","assignees_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/assignees{/user}","branches_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/branches{/branch}","tags_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/tags","blobs_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/git/refs{/sha}","trees_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/statuses/{sha}","languages_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/languages","stargazers_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/stargazers","contributors_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/contributors","subscribers_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/subscribers","subscription_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/subscription","commits_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/commits{/sha}","git_commits_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/git/commits{/sha}","comments_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/comments{/number}","issue_comment_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/issues/comments{/number}","contents_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/contents/{+path}","compare_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/merges","archive_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/downloads","issues_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/issues{/number}","pulls_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls{/number}","milestones_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/milestones{/number}","notifications_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/labels{/name}","releases_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/releases{/id}","deployments_url":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/deployments","created_at":"2016-12-01T12:05:02Z","updated_at":"2016-12-13T10:50:09Z","pushed_at":"2017-03-31T13:39:07Z","git_url":"git://github.com/ovotech/comms-gateway-event-manager.git","ssh_url":"git@github.com:ovotech/comms-gateway-event-manager.git","clone_url":"https://github.com/ovotech/comms-gateway-event-manager.git","svn_url":"https://github.com/ovotech/comms-gateway-event-manager","homepage":null,"size":165,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/24"},"html":{"href":"https://github.com/ovotech/comms-gateway-event-manager/pull/24"},"issue":{"href":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/issues/24"},"comments":{"href":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/issues/24/comments"},"review_comments":{"href":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/24/comments"},"review_comment":{"href":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/pulls/24/commits"},"statuses":{"href":"https://api.github.com/repos/ovotech/comms-gateway-event-manager/statuses/a27aa0ed8bf1a772c1e7bd5c42a41b52c708eb56"}}}}
{"actor":{"display_login":"fleetwoods"}}