{"action":"created","comment":{"url":"https://api.github.com/repos/DoSomething/phoenix/pulls/comments/53526163","id":53526163,"diff_hunk":"@@ -43,6 +43,30 @@ function dosomething_northstar_libraries_info() {\n   return $libraries;\n }\n \n+\n+/**\n+ * Verify the given credentials against Northstar, returning the authorized\n+ * user account if one exists.\n+ *\n+ * @param array $credentials\n+ * @return mixed|null\n+ */\n+function dosomething_northstar_verify_user($credentials) {\n+  $client = _dosomething_northstar_build_http_client();\n+\n+  $response = drupal_http_request($client['base_url'] . '/auth/verify', [\n+    'headers' => $client['headers'],\n+    'method' => 'POST',\n+    'data' => json_encode($credentials),\n+  ]);\n+\n+  if($response->code !== '200') {\n+    return null;","path":"lib/modules/dosomething/dosomething_northstar/dosomething_northstar.module","position":22,"original_position":22,"commit_id":"627a5b5e8bae0760a7ec19fde1fa228e882671da","original_commit_id":"627a5b5e8bae0760a7ec19fde1fa228e882671da","user":{"login":"DFurnes","id":583202,"avatar_url":"https://avatars.githubusercontent.com/u/583202?v=3","gravatar_id":"","url":"https://api.github.com/users/DFurnes","html_url":"https://github.com/DFurnes","followers_url":"https://api.github.com/users/DFurnes/followers","following_url":"https://api.github.com/users/DFurnes/following{/other_user}","gists_url":"https://api.github.com/users/DFurnes/gists{/gist_id}","starred_url":"https://api.github.com/users/DFurnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DFurnes/subscriptions","organizations_url":"https://api.github.com/users/DFurnes/orgs","repos_url":"https://api.github.com/users/DFurnes/repos","events_url":"https://api.github.com/users/DFurnes/events{/privacy}","received_events_url":"https://api.github.com/users/DFurnes/received_events","type":"User","site_admin":false},"body":"The only time this _should_ happen is if the given credentials doesn't exist in Northstar, which will return a `401`. It might be worth explicitly checking for the `401` to return `NULL` and then triggering a watchdog if any other code is returned?","created_at":"2016-02-19T22:13:33Z","updated_at":"2016-02-19T22:13:33Z","html_url":"https://github.com/DoSomething/phoenix/pull/6196#discussion_r53526163","pull_request_url":"https://api.github.com/repos/DoSomething/phoenix/pulls/6196","_links":{"self":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/comments/53526163"},"html":{"href":"https://github.com/DoSomething/phoenix/pull/6196#discussion_r53526163"},"pull_request":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/6196"}}},"pull_request":{"url":"https://api.github.com/repos/DoSomething/phoenix/pulls/6196","id":60012812,"html_url":"https://github.com/DoSomething/phoenix/pull/6196","diff_url":"https://github.com/DoSomething/phoenix/pull/6196.diff","patch_url":"https://github.com/DoSomething/phoenix/pull/6196.patch","issue_url":"https://api.github.com/repos/DoSomething/phoenix/issues/6196","number":6196,"state":"open","locked":false,"title":"Verify credentials against northstar","user":{"login":"DFurnes","id":583202,"avatar_url":"https://avatars.githubusercontent.com/u/583202?v=3","gravatar_id":"","url":"https://api.github.com/users/DFurnes","html_url":"https://github.com/DFurnes","followers_url":"https://api.github.com/users/DFurnes/followers","following_url":"https://api.github.com/users/DFurnes/following{/other_user}","gists_url":"https://api.github.com/users/DFurnes/gists{/gist_id}","starred_url":"https://api.github.com/users/DFurnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DFurnes/subscriptions","organizations_url":"https://api.github.com/users/DFurnes/orgs","repos_url":"https://api.github.com/users/DFurnes/repos","events_url":"https://api.github.com/users/DFurnes/events{/privacy}","received_events_url":"https://api.github.com/users/DFurnes/received_events","type":"User","site_admin":false},"body":"#### What's this PR do?\r\nThis PR adds \"mock\" authentication to Northstar after Drupal successfully authenticates a user locally.\r\n\r\n#### How should this be manually tested?\r\nOn your local box, pull down this code and run the ol' `drush fra -y`. Log in to your account, and you _should_ be able to see your Northstar ID saved to your Drupal profile (only visible from the admin profile interface).\r\n\r\n#### Any background context you want to provide?\r\nThis is a cautious step towards _actually_ authenticating all logins against Northstar. Let's just let it run in the background for a while and hopefully nothing goes wrong!\r\n\r\n#### What are the relevant tickets?\r\nReferences #4526.\r\n\r\n---\r\nFor review: @angaither ","created_at":"2016-02-19T21:52:22Z","updated_at":"2016-02-19T22:13:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a22168108e8ce6ddf6306b32f99347951f20c0af","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DoSomething/phoenix/pulls/6196/commits","review_comments_url":"https://api.github.com/repos/DoSomething/phoenix/pulls/6196/comments","review_comment_url":"https://api.github.com/repos/DoSomething/phoenix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DoSomething/phoenix/issues/6196/comments","statuses_url":"https://api.github.com/repos/DoSomething/phoenix/statuses/627a5b5e8bae0760a7ec19fde1fa228e882671da","head":{"label":"DFurnes:verify-credentials-against-northstar","ref":"verify-credentials-against-northstar","sha":"627a5b5e8bae0760a7ec19fde1fa228e882671da","user":{"login":"DFurnes","id":583202,"avatar_url":"https://avatars.githubusercontent.com/u/583202?v=3","gravatar_id":"","url":"https://api.github.com/users/DFurnes","html_url":"https://github.com/DFurnes","followers_url":"https://api.github.com/users/DFurnes/followers","following_url":"https://api.github.com/users/DFurnes/following{/other_user}","gists_url":"https://api.github.com/users/DFurnes/gists{/gist_id}","starred_url":"https://api.github.com/users/DFurnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DFurnes/subscriptions","organizations_url":"https://api.github.com/users/DFurnes/orgs","repos_url":"https://api.github.com/users/DFurnes/repos","events_url":"https://api.github.com/users/DFurnes/events{/privacy}","received_events_url":"https://api.github.com/users/DFurnes/received_events","type":"User","site_admin":false},"repo":{"id":23975099,"name":"phoenix","full_name":"DFurnes/phoenix","owner":{"login":"DFurnes","id":583202,"avatar_url":"https://avatars.githubusercontent.com/u/583202?v=3","gravatar_id":"","url":"https://api.github.com/users/DFurnes","html_url":"https://github.com/DFurnes","followers_url":"https://api.github.com/users/DFurnes/followers","following_url":"https://api.github.com/users/DFurnes/following{/other_user}","gists_url":"https://api.github.com/users/DFurnes/gists{/gist_id}","starred_url":"https://api.github.com/users/DFurnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DFurnes/subscriptions","organizations_url":"https://api.github.com/users/DFurnes/orgs","repos_url":"https://api.github.com/users/DFurnes/repos","events_url":"https://api.github.com/users/DFurnes/events{/privacy}","received_events_url":"https://api.github.com/users/DFurnes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DFurnes/phoenix","description":"A Drupal 7 distribution that powers the DoSomething.org web platform.","fork":true,"url":"https://api.github.com/repos/DFurnes/phoenix","forks_url":"https://api.github.com/repos/DFurnes/phoenix/forks","keys_url":"https://api.github.com/repos/DFurnes/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DFurnes/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DFurnes/phoenix/teams","hooks_url":"https://api.github.com/repos/DFurnes/phoenix/hooks","issue_events_url":"https://api.github.com/repos/DFurnes/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/DFurnes/phoenix/events","assignees_url":"https://api.github.com/repos/DFurnes/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/DFurnes/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/DFurnes/phoenix/tags","blobs_url":"https://api.github.com/repos/DFurnes/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DFurnes/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DFurnes/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/DFurnes/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DFurnes/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/DFurnes/phoenix/languages","stargazers_url":"https://api.github.com/repos/DFurnes/phoenix/stargazers","contributors_url":"https://api.github.com/repos/DFurnes/phoenix/contributors","subscribers_url":"https://api.github.com/repos/DFurnes/phoenix/subscribers","subscription_url":"https://api.github.com/repos/DFurnes/phoenix/subscription","commits_url":"https://api.github.com/repos/DFurnes/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/DFurnes/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/DFurnes/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/DFurnes/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/DFurnes/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/DFurnes/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DFurnes/phoenix/merges","archive_url":"https://api.github.com/repos/DFurnes/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DFurnes/phoenix/downloads","issues_url":"https://api.github.com/repos/DFurnes/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/DFurnes/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/DFurnes/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/DFurnes/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DFurnes/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/DFurnes/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/DFurnes/phoenix/deployments","created_at":"2014-09-12T20:07:06Z","updated_at":"2016-01-29T19:33:17Z","pushed_at":"2016-02-19T21:48:09Z","git_url":"git://github.com/DFurnes/phoenix.git","ssh_url":"git@github.com:DFurnes/phoenix.git","clone_url":"https://github.com/DFurnes/phoenix.git","svn_url":"https://github.com/DFurnes/phoenix","homepage":"http://www.dosomething.org/","size":16232,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"DoSomething:dev","ref":"dev","sha":"5a6bc35adeda5f739f135659844d1e2fa1f2bca8","user":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"repo":{"id":13592927,"name":"phoenix","full_name":"DoSomething/phoenix","owner":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DoSomething/phoenix","description":"A Drupal 7 distribution that powers the DoSomething.org web platform.","fork":false,"url":"https://api.github.com/repos/DoSomething/phoenix","forks_url":"https://api.github.com/repos/DoSomething/phoenix/forks","keys_url":"https://api.github.com/repos/DoSomething/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DoSomething/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DoSomething/phoenix/teams","hooks_url":"https://api.github.com/repos/DoSomething/phoenix/hooks","issue_events_url":"https://api.github.com/repos/DoSomething/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/DoSomething/phoenix/events","assignees_url":"https://api.github.com/repos/DoSomething/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/DoSomething/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/DoSomething/phoenix/tags","blobs_url":"https://api.github.com/repos/DoSomething/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DoSomething/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DoSomething/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/DoSomething/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DoSomething/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/DoSomething/phoenix/languages","stargazers_url":"https://api.github.com/repos/DoSomething/phoenix/stargazers","contributors_url":"https://api.github.com/repos/DoSomething/phoenix/contributors","subscribers_url":"https://api.github.com/repos/DoSomething/phoenix/subscribers","subscription_url":"https://api.github.com/repos/DoSomething/phoenix/subscription","commits_url":"https://api.github.com/repos/DoSomething/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/DoSomething/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/DoSomething/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/DoSomething/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/DoSomething/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/DoSomething/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DoSomething/phoenix/merges","archive_url":"https://api.github.com/repos/DoSomething/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DoSomething/phoenix/downloads","issues_url":"https://api.github.com/repos/DoSomething/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/DoSomething/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/DoSomething/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/DoSomething/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DoSomething/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/DoSomething/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/DoSomething/phoenix/deployments","created_at":"2013-10-15T14:50:48Z","updated_at":"2016-01-11T18:53:47Z","pushed_at":"2016-02-19T21:52:22Z","git_url":"git://github.com/DoSomething/phoenix.git","ssh_url":"git@github.com:DoSomething/phoenix.git","clone_url":"https://github.com/DoSomething/phoenix.git","svn_url":"https://github.com/DoSomething/phoenix","homepage":"http://www.dosomething.org/","size":17029,"stargazers_count":28,"watchers_count":28,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":189,"forks":18,"open_issues":189,"watchers":28,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/6196"},"html":{"href":"https://github.com/DoSomething/phoenix/pull/6196"},"issue":{"href":"https://api.github.com/repos/DoSomething/phoenix/issues/6196"},"comments":{"href":"https://api.github.com/repos/DoSomething/phoenix/issues/6196/comments"},"review_comments":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/6196/comments"},"review_comment":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/6196/commits"},"statuses":{"href":"https://api.github.com/repos/DoSomething/phoenix/statuses/627a5b5e8bae0760a7ec19fde1fa228e882671da"}}}}