{"action":"created","comment":{"url":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/comments/231769170","pull_request_review_id":172808682,"id":231769170,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMTc2OTE3MA==","diff_hunk":"@@ -0,0 +1,74 @@\n+const CustomStrategy = require('passport-custom').Strategy;\n+const strategyServices = require('./strategy_services');\n+const request = require('request-promise');\n+const Promise = require('bluebird');\n+const SALESFORCE_OAUTH_TOKEN_URL = process.env.SALESFORCE_OAUTH_TOKEN_URL || '';\n+const SALESFORCE_OAUTH_AUTHORIZE_URL = process.env.SALESFORCE_OAUTH_AUTHORIZE_URL || '';\n+\n+module.exports = (pb) => {\n+    async function getSalesforceSettings(req) {\n+        let pluginService = new pb.PluginService({\n+            site: req.ctx.__site\n+        });\n+        pluginService = Promise.promisifyAll(pluginService);\n+        const settings = await pluginService.getSettingsKVAsync('tn_join');\n+        return settings;\n+    }\n+\n+    async function salesforceCallback(req, done) {\n+        try {\n+            const loginContext = req.session._loginContext || {};\n+            const state = req.url.query.state;\n+            const code = req.url.query.code;\n+            const settings = await getSalesforceSettings(req);\n+            const options = {\n+                url: `${SALESFORCE_OAUTH_TOKEN_URL}?client_id=${settings.salesforce_client_id}&redirect_uri=${settings.salesforce_callback_url}&grant_type=authorization_code&code=${code}&client_secret=${settings.salesforce_client_secret}`,\n+                method: 'POST',\n+                json: true\n+            };\n+            const response = await request(options);\n+            const accessToken = response.access_token;\n+            let salesforceUser = await request.get(`https://login.salesforce.com/services/oauth2/userinfo?format=json&access_token=${accessToken}`);\n+            salesforceUser = JSON.parse(salesforceUser);\n+            let user = {\n+                first_name: salesforceUser.given_name,\n+                last_name: salesforceUser.family_name,\n+                username: salesforceUser.preferred_username,\n+                email: salesforceUser.email,\n+                admin: 0,","path":"include/koa/authentication/passport-strategies/salesforce_authentication_strategy.js","position":38,"original_position":38,"commit_id":"04eccaeb25b2322ad1ffce81ba62e508742805b0","original_commit_id":"04eccaeb25b2322ad1ffce81ba62e508742805b0","user":{"login":"lgenet","id":10148002,"node_id":"MDQ6VXNlcjEwMTQ4MDAy","avatar_url":"https://avatars0.githubusercontent.com/u/10148002?v=4","gravatar_id":"","url":"https://api.github.com/users/lgenet","html_url":"https://github.com/lgenet","followers_url":"https://api.github.com/users/lgenet/followers","following_url":"https://api.github.com/users/lgenet/following{/other_user}","gists_url":"https://api.github.com/users/lgenet/gists{/gist_id}","starred_url":"https://api.github.com/users/lgenet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lgenet/subscriptions","organizations_url":"https://api.github.com/users/lgenet/orgs","repos_url":"https://api.github.com/users/lgenet/repos","events_url":"https://api.github.com/users/lgenet/events{/privacy}","received_events_url":"https://api.github.com/users/lgenet/received_events","type":"User","site_admin":false},"body":"good.","created_at":"2018-11-08T05:35:04Z","updated_at":"2018-11-08T05:53:19Z","html_url":"https://github.com/careerbuilder/pencilblue/pull/95#discussion_r231769170","pull_request_url":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/95","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/comments/231769170"},"html":{"href":"https://github.com/careerbuilder/pencilblue/pull/95#discussion_r231769170"},"pull_request":{"href":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/95"}}},"pull_request":{"url":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/95","id":227780398,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3NzgwMzk4","html_url":"https://github.com/careerbuilder/pencilblue/pull/95","diff_url":"https://github.com/careerbuilder/pencilblue/pull/95.diff","patch_url":"https://github.com/careerbuilder/pencilblue/pull/95.patch","issue_url":"https://api.github.com/repos/careerbuilder/pencilblue/issues/95","number":95,"state":"open","locked":false,"title":"Cms sf passport","user":{"login":"DanielCoello","id":42450272,"node_id":"MDQ6VXNlcjQyNDUwMjcy","avatar_url":"https://avatars2.githubusercontent.com/u/42450272?v=4","gravatar_id":"","url":"https://api.github.com/users/DanielCoello","html_url":"https://github.com/DanielCoello","followers_url":"https://api.github.com/users/DanielCoello/followers","following_url":"https://api.github.com/users/DanielCoello/following{/other_user}","gists_url":"https://api.github.com/users/DanielCoello/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielCoello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielCoello/subscriptions","organizations_url":"https://api.github.com/users/DanielCoello/orgs","repos_url":"https://api.github.com/users/DanielCoello/repos","events_url":"https://api.github.com/users/DanielCoello/events{/privacy}","received_events_url":"https://api.github.com/users/DanielCoello/received_events","type":"User","site_admin":false},"body":"Fixes #\r\n\r\n- [ ] Unit tests created and pass\r\n- [ ] JS Docs have been updated\r\n\r\n**Description:**\r\n\r\n\r\n\r\n@pencilblue/owners\r\n","created_at":"2018-11-01T22:34:39Z","updated_at":"2018-11-08T05:53:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c8d42357f1ddef74aa35620438be1f528d3317c3","assignee":{"login":"DanielCoello","id":42450272,"node_id":"MDQ6VXNlcjQyNDUwMjcy","avatar_url":"https://avatars2.githubusercontent.com/u/42450272?v=4","gravatar_id":"","url":"https://api.github.com/users/DanielCoello","html_url":"https://github.com/DanielCoello","followers_url":"https://api.github.com/users/DanielCoello/followers","following_url":"https://api.github.com/users/DanielCoello/following{/other_user}","gists_url":"https://api.github.com/users/DanielCoello/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielCoello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielCoello/subscriptions","organizations_url":"https://api.github.com/users/DanielCoello/orgs","repos_url":"https://api.github.com/users/DanielCoello/repos","events_url":"https://api.github.com/users/DanielCoello/events{/privacy}","received_events_url":"https://api.github.com/users/DanielCoello/received_events","type":"User","site_admin":false},"assignees":[{"login":"DanielCoello","id":42450272,"node_id":"MDQ6VXNlcjQyNDUwMjcy","avatar_url":"https://avatars2.githubusercontent.com/u/42450272?v=4","gravatar_id":"","url":"https://api.github.com/users/DanielCoello","html_url":"https://github.com/DanielCoello","followers_url":"https://api.github.com/users/DanielCoello/followers","following_url":"https://api.github.com/users/DanielCoello/following{/other_user}","gists_url":"https://api.github.com/users/DanielCoello/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielCoello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielCoello/subscriptions","organizations_url":"https://api.github.com/users/DanielCoello/orgs","repos_url":"https://api.github.com/users/DanielCoello/repos","events_url":"https://api.github.com/users/DanielCoello/events{/privacy}","received_events_url":"https://api.github.com/users/DanielCoello/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/95/commits","review_comments_url":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/95/comments","review_comment_url":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/comments{/number}","comments_url":"https://api.github.com/repos/careerbuilder/pencilblue/issues/95/comments","statuses_url":"https://api.github.com/repos/careerbuilder/pencilblue/statuses/04eccaeb25b2322ad1ffce81ba62e508742805b0","head":{"label":"careerbuilder:cms-sf-passport","ref":"cms-sf-passport","sha":"04eccaeb25b2322ad1ffce81ba62e508742805b0","user":{"login":"careerbuilder","id":1043090,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNDMwOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/1043090?v=4","gravatar_id":"","url":"https://api.github.com/users/careerbuilder","html_url":"https://github.com/careerbuilder","followers_url":"https://api.github.com/users/careerbuilder/followers","following_url":"https://api.github.com/users/careerbuilder/following{/other_user}","gists_url":"https://api.github.com/users/careerbuilder/gists{/gist_id}","starred_url":"https://api.github.com/users/careerbuilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/careerbuilder/subscriptions","organizations_url":"https://api.github.com/users/careerbuilder/orgs","repos_url":"https://api.github.com/users/careerbuilder/repos","events_url":"https://api.github.com/users/careerbuilder/events{/privacy}","received_events_url":"https://api.github.com/users/careerbuilder/received_events","type":"Organization","site_admin":false},"repo":{"id":50383161,"node_id":"MDEwOlJlcG9zaXRvcnk1MDM4MzE2MQ==","name":"pencilblue","full_name":"careerbuilder/pencilblue","private":false,"owner":{"login":"careerbuilder","id":1043090,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNDMwOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/1043090?v=4","gravatar_id":"","url":"https://api.github.com/users/careerbuilder","html_url":"https://github.com/careerbuilder","followers_url":"https://api.github.com/users/careerbuilder/followers","following_url":"https://api.github.com/users/careerbuilder/following{/other_user}","gists_url":"https://api.github.com/users/careerbuilder/gists{/gist_id}","starred_url":"https://api.github.com/users/careerbuilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/careerbuilder/subscriptions","organizations_url":"https://api.github.com/users/careerbuilder/orgs","repos_url":"https://api.github.com/users/careerbuilder/repos","events_url":"https://api.github.com/users/careerbuilder/events{/privacy}","received_events_url":"https://api.github.com/users/careerbuilder/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/careerbuilder/pencilblue","description":"Business class content management for Node.js (plugins, server cluster management, data-driven pages)","fork":true,"url":"https://api.github.com/repos/careerbuilder/pencilblue","forks_url":"https://api.github.com/repos/careerbuilder/pencilblue/forks","keys_url":"https://api.github.com/repos/careerbuilder/pencilblue/keys{/key_id}","collaborators_url":"https://api.github.com/repos/careerbuilder/pencilblue/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/careerbuilder/pencilblue/teams","hooks_url":"https://api.github.com/repos/careerbuilder/pencilblue/hooks","issue_events_url":"https://api.github.com/repos/careerbuilder/pencilblue/issues/events{/number}","events_url":"https://api.github.com/repos/careerbuilder/pencilblue/events","assignees_url":"https://api.github.com/repos/careerbuilder/pencilblue/assignees{/user}","branches_url":"https://api.github.com/repos/careerbuilder/pencilblue/branches{/branch}","tags_url":"https://api.github.com/repos/careerbuilder/pencilblue/tags","blobs_url":"https://api.github.com/repos/careerbuilder/pencilblue/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/careerbuilder/pencilblue/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/careerbuilder/pencilblue/git/refs{/sha}","trees_url":"https://api.github.com/repos/careerbuilder/pencilblue/git/trees{/sha}","statuses_url":"https://api.github.com/repos/careerbuilder/pencilblue/statuses/{sha}","languages_url":"https://api.github.com/repos/careerbuilder/pencilblue/languages","stargazers_url":"https://api.github.com/repos/careerbuilder/pencilblue/stargazers","contributors_url":"https://api.github.com/repos/careerbuilder/pencilblue/contributors","subscribers_url":"https://api.github.com/repos/careerbuilder/pencilblue/subscribers","subscription_url":"https://api.github.com/repos/careerbuilder/pencilblue/subscription","commits_url":"https://api.github.com/repos/careerbuilder/pencilblue/commits{/sha}","git_commits_url":"https://api.github.com/repos/careerbuilder/pencilblue/git/commits{/sha}","comments_url":"https://api.github.com/repos/careerbuilder/pencilblue/comments{/number}","issue_comment_url":"https://api.github.com/repos/careerbuilder/pencilblue/issues/comments{/number}","contents_url":"https://api.github.com/repos/careerbuilder/pencilblue/contents/{+path}","compare_url":"https://api.github.com/repos/careerbuilder/pencilblue/compare/{base}...{head}","merges_url":"https://api.github.com/repos/careerbuilder/pencilblue/merges","archive_url":"https://api.github.com/repos/careerbuilder/pencilblue/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/careerbuilder/pencilblue/downloads","issues_url":"https://api.github.com/repos/careerbuilder/pencilblue/issues{/number}","pulls_url":"https://api.github.com/repos/careerbuilder/pencilblue/pulls{/number}","milestones_url":"https://api.github.com/repos/careerbuilder/pencilblue/milestones{/number}","notifications_url":"https://api.github.com/repos/careerbuilder/pencilblue/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/careerbuilder/pencilblue/labels{/name}","releases_url":"https://api.github.com/repos/careerbuilder/pencilblue/releases{/id}","deployments_url":"https://api.github.com/repos/careerbuilder/pencilblue/deployments","created_at":"2016-01-25T21:44:26Z","updated_at":"2018-01-23T15:26:27Z","pushed_at":"2018-11-06T23:43:44Z","git_url":"git://github.com/careerbuilder/pencilblue.git","ssh_url":"git@github.com:careerbuilder/pencilblue.git","clone_url":"https://github.com/careerbuilder/pencilblue.git","svn_url":"https://github.com/careerbuilder/pencilblue","homepage":"https://pencilblue.org","size":17462,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":2,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"careerbuilder:cms-pb-1-0-0","ref":"cms-pb-1-0-0","sha":"555f1ef6a8c9f6cfe53e1092869d8d26f8bfe7d8","user":{"login":"careerbuilder","id":1043090,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNDMwOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/1043090?v=4","gravatar_id":"","url":"https://api.github.com/users/careerbuilder","html_url":"https://github.com/careerbuilder","followers_url":"https://api.github.com/users/careerbuilder/followers","following_url":"https://api.github.com/users/careerbuilder/following{/other_user}","gists_url":"https://api.github.com/users/careerbuilder/gists{/gist_id}","starred_url":"https://api.github.com/users/careerbuilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/careerbuilder/subscriptions","organizations_url":"https://api.github.com/users/careerbuilder/orgs","repos_url":"https://api.github.com/users/careerbuilder/repos","events_url":"https://api.github.com/users/careerbuilder/events{/privacy}","received_events_url":"https://api.github.com/users/careerbuilder/received_events","type":"Organization","site_admin":false},"repo":{"id":50383161,"node_id":"MDEwOlJlcG9zaXRvcnk1MDM4MzE2MQ==","name":"pencilblue","full_name":"careerbuilder/pencilblue","private":false,"owner":{"login":"careerbuilder","id":1043090,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEwNDMwOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/1043090?v=4","gravatar_id":"","url":"https://api.github.com/users/careerbuilder","html_url":"https://github.com/careerbuilder","followers_url":"https://api.github.com/users/careerbuilder/followers","following_url":"https://api.github.com/users/careerbuilder/following{/other_user}","gists_url":"https://api.github.com/users/careerbuilder/gists{/gist_id}","starred_url":"https://api.github.com/users/careerbuilder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/careerbuilder/subscriptions","organizations_url":"https://api.github.com/users/careerbuilder/orgs","repos_url":"https://api.github.com/users/careerbuilder/repos","events_url":"https://api.github.com/users/careerbuilder/events{/privacy}","received_events_url":"https://api.github.com/users/careerbuilder/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/careerbuilder/pencilblue","description":"Business class content management for Node.js (plugins, server cluster management, data-driven pages)","fork":true,"url":"https://api.github.com/repos/careerbuilder/pencilblue","forks_url":"https://api.github.com/repos/careerbuilder/pencilblue/forks","keys_url":"https://api.github.com/repos/careerbuilder/pencilblue/keys{/key_id}","collaborators_url":"https://api.github.com/repos/careerbuilder/pencilblue/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/careerbuilder/pencilblue/teams","hooks_url":"https://api.github.com/repos/careerbuilder/pencilblue/hooks","issue_events_url":"https://api.github.com/repos/careerbuilder/pencilblue/issues/events{/number}","events_url":"https://api.github.com/repos/careerbuilder/pencilblue/events","assignees_url":"https://api.github.com/repos/careerbuilder/pencilblue/assignees{/user}","branches_url":"https://api.github.com/repos/careerbuilder/pencilblue/branches{/branch}","tags_url":"https://api.github.com/repos/careerbuilder/pencilblue/tags","blobs_url":"https://api.github.com/repos/careerbuilder/pencilblue/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/careerbuilder/pencilblue/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/careerbuilder/pencilblue/git/refs{/sha}","trees_url":"https://api.github.com/repos/careerbuilder/pencilblue/git/trees{/sha}","statuses_url":"https://api.github.com/repos/careerbuilder/pencilblue/statuses/{sha}","languages_url":"https://api.github.com/repos/careerbuilder/pencilblue/languages","stargazers_url":"https://api.github.com/repos/careerbuilder/pencilblue/stargazers","contributors_url":"https://api.github.com/repos/careerbuilder/pencilblue/contributors","subscribers_url":"https://api.github.com/repos/careerbuilder/pencilblue/subscribers","subscription_url":"https://api.github.com/repos/careerbuilder/pencilblue/subscription","commits_url":"https://api.github.com/repos/careerbuilder/pencilblue/commits{/sha}","git_commits_url":"https://api.github.com/repos/careerbuilder/pencilblue/git/commits{/sha}","comments_url":"https://api.github.com/repos/careerbuilder/pencilblue/comments{/number}","issue_comment_url":"https://api.github.com/repos/careerbuilder/pencilblue/issues/comments{/number}","contents_url":"https://api.github.com/repos/careerbuilder/pencilblue/contents/{+path}","compare_url":"https://api.github.com/repos/careerbuilder/pencilblue/compare/{base}...{head}","merges_url":"https://api.github.com/repos/careerbuilder/pencilblue/merges","archive_url":"https://api.github.com/repos/careerbuilder/pencilblue/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/careerbuilder/pencilblue/downloads","issues_url":"https://api.github.com/repos/careerbuilder/pencilblue/issues{/number}","pulls_url":"https://api.github.com/repos/careerbuilder/pencilblue/pulls{/number}","milestones_url":"https://api.github.com/repos/careerbuilder/pencilblue/milestones{/number}","notifications_url":"https://api.github.com/repos/careerbuilder/pencilblue/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/careerbuilder/pencilblue/labels{/name}","releases_url":"https://api.github.com/repos/careerbuilder/pencilblue/releases{/id}","deployments_url":"https://api.github.com/repos/careerbuilder/pencilblue/deployments","created_at":"2016-01-25T21:44:26Z","updated_at":"2018-01-23T15:26:27Z","pushed_at":"2018-11-06T23:43:44Z","git_url":"git://github.com/careerbuilder/pencilblue.git","ssh_url":"git@github.com:careerbuilder/pencilblue.git","clone_url":"https://github.com/careerbuilder/pencilblue.git","svn_url":"https://github.com/careerbuilder/pencilblue","homepage":"https://pencilblue.org","size":17462,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":2,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/95"},"html":{"href":"https://github.com/careerbuilder/pencilblue/pull/95"},"issue":{"href":"https://api.github.com/repos/careerbuilder/pencilblue/issues/95"},"comments":{"href":"https://api.github.com/repos/careerbuilder/pencilblue/issues/95/comments"},"review_comments":{"href":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/95/comments"},"review_comment":{"href":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/careerbuilder/pencilblue/pulls/95/commits"},"statuses":{"href":"https://api.github.com/repos/careerbuilder/pencilblue/statuses/04eccaeb25b2322ad1ffce81ba62e508742805b0"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"lgenet"}}