{"action":"created","comment":{"url":"https://api.github.com/repos/opentable/oc/pulls/comments/41774702","id":41774702,"diff_hunk":"@@ -0,0 +1,50 @@\n+'use strict';\n+\n+var path = require('path');\n+var strings = require('../../resources/');\n+var format = require('stringformat');\n+\n+var builtin = {\n+  basic: {\n+    validate: function(authConfig){\n+      var isValid = authConfig.username && authConfig.password;\n+      return {\n+          isValid: isValid,\n+          message: isValid ? '' : strings.errors.registry.CONFIGURATION_PUBLISH_BASIC_AUTH_CREDENTIALS_MISSING\n+      };\n+    },\n+    middleware: function(authConfig){\n+      var express = require('express');\n+      return express.basicAuth(authConfig.username, authConfig.password);\n+    }\n+  }\n+};\n+\n+var scheme;\n+\n+module.exports.validate = function(authConfig){\n+  if(builtin[authConfig.type]){\n+    scheme = builtin[authConfig.type];\n+  }\n+  else {\n+    var cwd = process.cwd();\n+    module.paths.push(cwd, path.join(cwd, 'node_modules'));","path":"registry/domain/authentication.js","position":31,"original_position":31,"commit_id":"1cca44d3aa59d0a57dd140a58b3ff2de1b8b2bc6","original_commit_id":"1cca44d3aa59d0a57dd140a58b3ff2de1b8b2bc6","user":{"login":"matteofigus","id":1789893,"avatar_url":"https://avatars.githubusercontent.com/u/1789893?v=3","gravatar_id":"","url":"https://api.github.com/users/matteofigus","html_url":"https://github.com/matteofigus","followers_url":"https://api.github.com/users/matteofigus/followers","following_url":"https://api.github.com/users/matteofigus/following{/other_user}","gists_url":"https://api.github.com/users/matteofigus/gists{/gist_id}","starred_url":"https://api.github.com/users/matteofigus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matteofigus/subscriptions","organizations_url":"https://api.github.com/users/matteofigus/orgs","repos_url":"https://api.github.com/users/matteofigus/repos","events_url":"https://api.github.com/users/matteofigus/events{/privacy}","received_events_url":"https://api.github.com/users/matteofigus/received_events","type":"User","site_admin":false},"body":"What is this for? Can't find any documentation about `module.paths`","created_at":"2015-10-12T16:31:14Z","updated_at":"2015-10-12T16:31:14Z","html_url":"https://github.com/opentable/oc/pull/120#discussion_r41774702","pull_request_url":"https://api.github.com/repos/opentable/oc/pulls/120","_links":{"self":{"href":"https://api.github.com/repos/opentable/oc/pulls/comments/41774702"},"html":{"href":"https://github.com/opentable/oc/pull/120#discussion_r41774702"},"pull_request":{"href":"https://api.github.com/repos/opentable/oc/pulls/120"}}},"pull_request":{"url":"https://api.github.com/repos/opentable/oc/pulls/120","id":47408530,"html_url":"https://github.com/opentable/oc/pull/120","diff_url":"https://github.com/opentable/oc/pull/120.diff","patch_url":"https://github.com/opentable/oc/pull/120.patch","issue_url":"https://api.github.com/repos/opentable/oc/issues/120","number":120,"state":"open","locked":false,"title":"first go at an interface for auth plugins","user":{"login":"andyroyle","id":1472779,"avatar_url":"https://avatars.githubusercontent.com/u/1472779?v=3","gravatar_id":"","url":"https://api.github.com/users/andyroyle","html_url":"https://github.com/andyroyle","followers_url":"https://api.github.com/users/andyroyle/followers","following_url":"https://api.github.com/users/andyroyle/following{/other_user}","gists_url":"https://api.github.com/users/andyroyle/gists{/gist_id}","starred_url":"https://api.github.com/users/andyroyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyroyle/subscriptions","organizations_url":"https://api.github.com/users/andyroyle/orgs","repos_url":"https://api.github.com/users/andyroyle/repos","events_url":"https://api.github.com/users/andyroyle/events{/privacy}","received_events_url":"https://api.github.com/users/andyroyle/received_events","type":"User","site_admin":false},"body":"interface for an auth plugin:\r\n\r\n```javascript\r\n{\r\n  validate: function(authConfig){\r\n    // validate the config object\r\n    // also optionally do any setup the scheme needs\r\n    return {\r\n      isValid: false\r\n      message: 'blarg' // when isValid is false this should contain the error message\r\n    };\r\n  },\r\n  middleware: function(authConfig){\r\n    // should return an express middleware function\r\n    return function(req, res, next){ next(); };\r\n}\r\n```\r\n\r\nThe plugins are indexed by type, so for an authentication `type: 'foo'` looks for a module called `oc-auth-foo` installed alongside `oc`\r\n\r\ne.g.\r\n\r\n```\r\nmyregistry:\r\n  |- oc\r\n  |- oc-auth-foo\r\n```\r\n\r\nAnd the authConfig will access the plugin using `oc-auth-{type}`.\r\n\r\nauthConfig: \r\n```json\r\n{\r\n    \"type\": \"foo\",\r\n    \"bar\": \"baz\"\r\n}\r\n```\r\n\r\nBasic Auth is still included by default.","created_at":"2015-10-12T11:19:28Z","updated_at":"2015-10-12T16:31:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7dea684e040b9cf924a7f391f4d016ce211ceb1e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/opentable/oc/pulls/120/commits","review_comments_url":"https://api.github.com/repos/opentable/oc/pulls/120/comments","review_comment_url":"https://api.github.com/repos/opentable/oc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opentable/oc/issues/120/comments","statuses_url":"https://api.github.com/repos/opentable/oc/statuses/1cca44d3aa59d0a57dd140a58b3ff2de1b8b2bc6","head":{"label":"opentable:auth-plugins","ref":"auth-plugins","sha":"1cca44d3aa59d0a57dd140a58b3ff2de1b8b2bc6","user":{"login":"opentable","id":2653541,"avatar_url":"https://avatars.githubusercontent.com/u/2653541?v=3","gravatar_id":"","url":"https://api.github.com/users/opentable","html_url":"https://github.com/opentable","followers_url":"https://api.github.com/users/opentable/followers","following_url":"https://api.github.com/users/opentable/following{/other_user}","gists_url":"https://api.github.com/users/opentable/gists{/gist_id}","starred_url":"https://api.github.com/users/opentable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentable/subscriptions","organizations_url":"https://api.github.com/users/opentable/orgs","repos_url":"https://api.github.com/users/opentable/repos","events_url":"https://api.github.com/users/opentable/events{/privacy}","received_events_url":"https://api.github.com/users/opentable/received_events","type":"Organization","site_admin":false},"repo":{"id":29561741,"name":"oc","full_name":"opentable/oc","owner":{"login":"opentable","id":2653541,"avatar_url":"https://avatars.githubusercontent.com/u/2653541?v=3","gravatar_id":"","url":"https://api.github.com/users/opentable","html_url":"https://github.com/opentable","followers_url":"https://api.github.com/users/opentable/followers","following_url":"https://api.github.com/users/opentable/following{/other_user}","gists_url":"https://api.github.com/users/opentable/gists{/gist_id}","starred_url":"https://api.github.com/users/opentable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentable/subscriptions","organizations_url":"https://api.github.com/users/opentable/orgs","repos_url":"https://api.github.com/users/opentable/repos","events_url":"https://api.github.com/users/opentable/events{/privacy}","received_events_url":"https://api.github.com/users/opentable/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opentable/oc","description":"OpenComponents, a framework for developing and distributing html components","fork":false,"url":"https://api.github.com/repos/opentable/oc","forks_url":"https://api.github.com/repos/opentable/oc/forks","keys_url":"https://api.github.com/repos/opentable/oc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opentable/oc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opentable/oc/teams","hooks_url":"https://api.github.com/repos/opentable/oc/hooks","issue_events_url":"https://api.github.com/repos/opentable/oc/issues/events{/number}","events_url":"https://api.github.com/repos/opentable/oc/events","assignees_url":"https://api.github.com/repos/opentable/oc/assignees{/user}","branches_url":"https://api.github.com/repos/opentable/oc/branches{/branch}","tags_url":"https://api.github.com/repos/opentable/oc/tags","blobs_url":"https://api.github.com/repos/opentable/oc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opentable/oc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opentable/oc/git/refs{/sha}","trees_url":"https://api.github.com/repos/opentable/oc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opentable/oc/statuses/{sha}","languages_url":"https://api.github.com/repos/opentable/oc/languages","stargazers_url":"https://api.github.com/repos/opentable/oc/stargazers","contributors_url":"https://api.github.com/repos/opentable/oc/contributors","subscribers_url":"https://api.github.com/repos/opentable/oc/subscribers","subscription_url":"https://api.github.com/repos/opentable/oc/subscription","commits_url":"https://api.github.com/repos/opentable/oc/commits{/sha}","git_commits_url":"https://api.github.com/repos/opentable/oc/git/commits{/sha}","comments_url":"https://api.github.com/repos/opentable/oc/comments{/number}","issue_comment_url":"https://api.github.com/repos/opentable/oc/issues/comments{/number}","contents_url":"https://api.github.com/repos/opentable/oc/contents/{+path}","compare_url":"https://api.github.com/repos/opentable/oc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opentable/oc/merges","archive_url":"https://api.github.com/repos/opentable/oc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opentable/oc/downloads","issues_url":"https://api.github.com/repos/opentable/oc/issues{/number}","pulls_url":"https://api.github.com/repos/opentable/oc/pulls{/number}","milestones_url":"https://api.github.com/repos/opentable/oc/milestones{/number}","notifications_url":"https://api.github.com/repos/opentable/oc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opentable/oc/labels{/name}","releases_url":"https://api.github.com/repos/opentable/oc/releases{/id}","created_at":"2015-01-20T23:56:08Z","updated_at":"2015-10-11T18:31:28Z","pushed_at":"2015-10-12T11:19:28Z","git_url":"git://github.com/opentable/oc.git","ssh_url":"git@github.com:opentable/oc.git","clone_url":"https://github.com/opentable/oc.git","svn_url":"https://github.com/opentable/oc","homepage":"","size":1896,"stargazers_count":33,"watchers_count":33,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":11,"forks":11,"open_issues":11,"watchers":33,"default_branch":"master"}},"base":{"label":"opentable:master","ref":"master","sha":"142af7eb329b98fdb4dd2768a4c6661a4a8b67d0","user":{"login":"opentable","id":2653541,"avatar_url":"https://avatars.githubusercontent.com/u/2653541?v=3","gravatar_id":"","url":"https://api.github.com/users/opentable","html_url":"https://github.com/opentable","followers_url":"https://api.github.com/users/opentable/followers","following_url":"https://api.github.com/users/opentable/following{/other_user}","gists_url":"https://api.github.com/users/opentable/gists{/gist_id}","starred_url":"https://api.github.com/users/opentable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentable/subscriptions","organizations_url":"https://api.github.com/users/opentable/orgs","repos_url":"https://api.github.com/users/opentable/repos","events_url":"https://api.github.com/users/opentable/events{/privacy}","received_events_url":"https://api.github.com/users/opentable/received_events","type":"Organization","site_admin":false},"repo":{"id":29561741,"name":"oc","full_name":"opentable/oc","owner":{"login":"opentable","id":2653541,"avatar_url":"https://avatars.githubusercontent.com/u/2653541?v=3","gravatar_id":"","url":"https://api.github.com/users/opentable","html_url":"https://github.com/opentable","followers_url":"https://api.github.com/users/opentable/followers","following_url":"https://api.github.com/users/opentable/following{/other_user}","gists_url":"https://api.github.com/users/opentable/gists{/gist_id}","starred_url":"https://api.github.com/users/opentable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentable/subscriptions","organizations_url":"https://api.github.com/users/opentable/orgs","repos_url":"https://api.github.com/users/opentable/repos","events_url":"https://api.github.com/users/opentable/events{/privacy}","received_events_url":"https://api.github.com/users/opentable/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opentable/oc","description":"OpenComponents, a framework for developing and distributing html components","fork":false,"url":"https://api.github.com/repos/opentable/oc","forks_url":"https://api.github.com/repos/opentable/oc/forks","keys_url":"https://api.github.com/repos/opentable/oc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opentable/oc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opentable/oc/teams","hooks_url":"https://api.github.com/repos/opentable/oc/hooks","issue_events_url":"https://api.github.com/repos/opentable/oc/issues/events{/number}","events_url":"https://api.github.com/repos/opentable/oc/events","assignees_url":"https://api.github.com/repos/opentable/oc/assignees{/user}","branches_url":"https://api.github.com/repos/opentable/oc/branches{/branch}","tags_url":"https://api.github.com/repos/opentable/oc/tags","blobs_url":"https://api.github.com/repos/opentable/oc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opentable/oc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opentable/oc/git/refs{/sha}","trees_url":"https://api.github.com/repos/opentable/oc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opentable/oc/statuses/{sha}","languages_url":"https://api.github.com/repos/opentable/oc/languages","stargazers_url":"https://api.github.com/repos/opentable/oc/stargazers","contributors_url":"https://api.github.com/repos/opentable/oc/contributors","subscribers_url":"https://api.github.com/repos/opentable/oc/subscribers","subscription_url":"https://api.github.com/repos/opentable/oc/subscription","commits_url":"https://api.github.com/repos/opentable/oc/commits{/sha}","git_commits_url":"https://api.github.com/repos/opentable/oc/git/commits{/sha}","comments_url":"https://api.github.com/repos/opentable/oc/comments{/number}","issue_comment_url":"https://api.github.com/repos/opentable/oc/issues/comments{/number}","contents_url":"https://api.github.com/repos/opentable/oc/contents/{+path}","compare_url":"https://api.github.com/repos/opentable/oc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opentable/oc/merges","archive_url":"https://api.github.com/repos/opentable/oc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opentable/oc/downloads","issues_url":"https://api.github.com/repos/opentable/oc/issues{/number}","pulls_url":"https://api.github.com/repos/opentable/oc/pulls{/number}","milestones_url":"https://api.github.com/repos/opentable/oc/milestones{/number}","notifications_url":"https://api.github.com/repos/opentable/oc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opentable/oc/labels{/name}","releases_url":"https://api.github.com/repos/opentable/oc/releases{/id}","created_at":"2015-01-20T23:56:08Z","updated_at":"2015-10-11T18:31:28Z","pushed_at":"2015-10-12T11:19:28Z","git_url":"git://github.com/opentable/oc.git","ssh_url":"git@github.com:opentable/oc.git","clone_url":"https://github.com/opentable/oc.git","svn_url":"https://github.com/opentable/oc","homepage":"","size":1896,"stargazers_count":33,"watchers_count":33,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":11,"forks":11,"open_issues":11,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opentable/oc/pulls/120"},"html":{"href":"https://github.com/opentable/oc/pull/120"},"issue":{"href":"https://api.github.com/repos/opentable/oc/issues/120"},"comments":{"href":"https://api.github.com/repos/opentable/oc/issues/120/comments"},"review_comments":{"href":"https://api.github.com/repos/opentable/oc/pulls/120/comments"},"review_comment":{"href":"https://api.github.com/repos/opentable/oc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opentable/oc/pulls/120/commits"},"statuses":{"href":"https://api.github.com/repos/opentable/oc/statuses/1cca44d3aa59d0a57dd140a58b3ff2de1b8b2bc6"}}}}