{"action":"created","comment":{"url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/comments/157084965","pull_request_review_id":83672219,"id":157084965,"diff_hunk":"@@ -0,0 +1,61 @@\n+'use strict';\n+\n+var passport = require('passport');\n+var request = require('request');\n+var debug = require('debug')('portal:auth:oauth2');\n+var jwt = require('jsonwebtoken');\n+\n+var OAuth2Strategy = require('passport-oauth').OAuth2Strategy;\n+\n+var utils = require('../../routes/utils');\n+var portalGlobals = require('../../portalGlobals');\n+\n+var federate = require('../federate');\n+\n+var oauth2Strategy = null;\n+\n+if (portalGlobals.glob.auth.oauth2 && \n+    portalGlobals.glob.auth.oauth2.useOauth2) {\n+    debug('Initializing Oauth2 Authentication');\n+    var oauth2Glob = portalGlobals.glob.auth.oauth2;\n+    \n+    oauth2Strategy = new OAuth2Strategy({\n+        authorizationURL: oauth2Glob.authorizationURL,\n+        tokenURL: oauth2Glob.tokenURL,\n+        clientID: oauth2Glob.clientID,\n+        clientSecret: oauth2Glob.clientSecret,\n+        callbackURL: oauth2Glob.callbackURL,\n+        passReqToCallback: true\n+    }, function(req, accessToken, refreshToken, profile, done) {\n+        debug('Oauth2 Authentication');\n+        var decodedProfile = jwt.decode(accessToken);\n+        var defaultGroups = [];\n+        if(decodedProfile['group']){\n+          defaultGroups = decodedProfile['group'];","path":"auth/oauth2/passport.js","position":34,"original_position":34,"commit_id":"f777d57f13cee35ce138ace9020356dd2fa79578","original_commit_id":"f777d57f13cee35ce138ace9020356dd2fa79578","user":{"login":"santokhsingh","id":9421117,"avatar_url":"https://avatars1.githubusercontent.com/u/9421117?v=4","gravatar_id":"","url":"https://api.github.com/users/santokhsingh","html_url":"https://github.com/santokhsingh","followers_url":"https://api.github.com/users/santokhsingh/followers","following_url":"https://api.github.com/users/santokhsingh/following{/other_user}","gists_url":"https://api.github.com/users/santokhsingh/gists{/gist_id}","starred_url":"https://api.github.com/users/santokhsingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santokhsingh/subscriptions","organizations_url":"https://api.github.com/users/santokhsingh/orgs","repos_url":"https://api.github.com/users/santokhsingh/repos","events_url":"https://api.github.com/users/santokhsingh/events{/privacy}","received_events_url":"https://api.github.com/users/santokhsingh/received_events","type":"User","site_admin":false},"body":"Just a question regarding this, so that I am clear on this. Do you wish to have same capability as ADFS, which is (OPTION A): (1) verify certificate (2) decode token (3) call groups endpoint to get back groups.  OR (OPTION B): you mean that I should call a  \"matchGroup\" function same as ADFS on the groups I retrieved from the token. In our case groups are part of token. I can implement OPTION A in such a way that it only calls groups end point in case it could not find groups in the token. Please advice.","created_at":"2017-12-14T22:56:12Z","updated_at":"2017-12-14T22:56:12Z","html_url":"https://github.com/apim-haufe-io/wicked.portal/pull/11#discussion_r157084965","pull_request_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/11","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/comments/157084965"},"html":{"href":"https://github.com/apim-haufe-io/wicked.portal/pull/11#discussion_r157084965"},"pull_request":{"href":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/11"}},"in_reply_to_id":157040302},"pull_request":{"url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/11","id":143997568,"html_url":"https://github.com/apim-haufe-io/wicked.portal/pull/11","diff_url":"https://github.com/apim-haufe-io/wicked.portal/pull/11.diff","patch_url":"https://github.com/apim-haufe-io/wicked.portal/pull/11.patch","issue_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/issues/11","number":11,"state":"open","locked":false,"title":"Feat/oauth2 generic","user":{"login":"santokhsingh","id":9421117,"avatar_url":"https://avatars1.githubusercontent.com/u/9421117?v=4","gravatar_id":"","url":"https://api.github.com/users/santokhsingh","html_url":"https://github.com/santokhsingh","followers_url":"https://api.github.com/users/santokhsingh/followers","following_url":"https://api.github.com/users/santokhsingh/following{/other_user}","gists_url":"https://api.github.com/users/santokhsingh/gists{/gist_id}","starred_url":"https://api.github.com/users/santokhsingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santokhsingh/subscriptions","organizations_url":"https://api.github.com/users/santokhsingh/orgs","repos_url":"https://api.github.com/users/santokhsingh/repos","events_url":"https://api.github.com/users/santokhsingh/events{/privacy}","received_events_url":"https://api.github.com/users/santokhsingh/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-09-29T23:09:42Z","updated_at":"2017-12-14T22:56:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"520a1b85d8955f761f674ca417cc757fc55e8127","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/11/commits","review_comments_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/11/comments","review_comment_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/issues/11/comments","statuses_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/statuses/f777d57f13cee35ce138ace9020356dd2fa79578","head":{"label":"apim-haufe-io:feat/oauth2-generic","ref":"feat/oauth2-generic","sha":"f777d57f13cee35ce138ace9020356dd2fa79578","user":{"login":"apim-haufe-io","id":26771679,"avatar_url":"https://avatars1.githubusercontent.com/u/26771679?v=4","gravatar_id":"","url":"https://api.github.com/users/apim-haufe-io","html_url":"https://github.com/apim-haufe-io","followers_url":"https://api.github.com/users/apim-haufe-io/followers","following_url":"https://api.github.com/users/apim-haufe-io/following{/other_user}","gists_url":"https://api.github.com/users/apim-haufe-io/gists{/gist_id}","starred_url":"https://api.github.com/users/apim-haufe-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apim-haufe-io/subscriptions","organizations_url":"https://api.github.com/users/apim-haufe-io/orgs","repos_url":"https://api.github.com/users/apim-haufe-io/repos","events_url":"https://api.github.com/users/apim-haufe-io/events{/privacy}","received_events_url":"https://api.github.com/users/apim-haufe-io/received_events","type":"Organization","site_admin":false},"repo":{"id":65024443,"name":"wicked.portal","full_name":"apim-haufe-io/wicked.portal","owner":{"login":"apim-haufe-io","id":26771679,"avatar_url":"https://avatars1.githubusercontent.com/u/26771679?v=4","gravatar_id":"","url":"https://api.github.com/users/apim-haufe-io","html_url":"https://github.com/apim-haufe-io","followers_url":"https://api.github.com/users/apim-haufe-io/followers","following_url":"https://api.github.com/users/apim-haufe-io/following{/other_user}","gists_url":"https://api.github.com/users/apim-haufe-io/gists{/gist_id}","starred_url":"https://api.github.com/users/apim-haufe-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apim-haufe-io/subscriptions","organizations_url":"https://api.github.com/users/apim-haufe-io/orgs","repos_url":"https://api.github.com/users/apim-haufe-io/repos","events_url":"https://api.github.com/users/apim-haufe-io/events{/privacy}","received_events_url":"https://api.github.com/users/apim-haufe-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apim-haufe-io/wicked.portal","description":"wicked.haufe.io - API Portal UI service","fork":false,"url":"https://api.github.com/repos/apim-haufe-io/wicked.portal","forks_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/forks","keys_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/teams","hooks_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/hooks","issue_events_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/issues/events{/number}","events_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/events","assignees_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/assignees{/user}","branches_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/branches{/branch}","tags_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/tags","blobs_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/statuses/{sha}","languages_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/languages","stargazers_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/stargazers","contributors_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/contributors","subscribers_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/subscribers","subscription_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/subscription","commits_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/contents/{+path}","compare_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/merges","archive_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/downloads","issues_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/issues{/number}","pulls_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls{/number}","milestones_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/milestones{/number}","notifications_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/labels{/name}","releases_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/releases{/id}","deployments_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/deployments","created_at":"2016-08-05T14:21:31Z","updated_at":"2017-08-31T08:24:07Z","pushed_at":"2017-12-14T19:33:12Z","git_url":"git://github.com/apim-haufe-io/wicked.portal.git","ssh_url":"git@github.com:apim-haufe-io/wicked.portal.git","clone_url":"https://github.com/apim-haufe-io/wicked.portal.git","svn_url":"https://github.com/apim-haufe-io/wicked.portal","homepage":null,"size":386,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":8,"open_issues":2,"watchers":0,"default_branch":"next"}},"base":{"label":"apim-haufe-io:next","ref":"next","sha":"6b8fdeffc904d6de3be86795be56d56226d7d544","user":{"login":"apim-haufe-io","id":26771679,"avatar_url":"https://avatars1.githubusercontent.com/u/26771679?v=4","gravatar_id":"","url":"https://api.github.com/users/apim-haufe-io","html_url":"https://github.com/apim-haufe-io","followers_url":"https://api.github.com/users/apim-haufe-io/followers","following_url":"https://api.github.com/users/apim-haufe-io/following{/other_user}","gists_url":"https://api.github.com/users/apim-haufe-io/gists{/gist_id}","starred_url":"https://api.github.com/users/apim-haufe-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apim-haufe-io/subscriptions","organizations_url":"https://api.github.com/users/apim-haufe-io/orgs","repos_url":"https://api.github.com/users/apim-haufe-io/repos","events_url":"https://api.github.com/users/apim-haufe-io/events{/privacy}","received_events_url":"https://api.github.com/users/apim-haufe-io/received_events","type":"Organization","site_admin":false},"repo":{"id":65024443,"name":"wicked.portal","full_name":"apim-haufe-io/wicked.portal","owner":{"login":"apim-haufe-io","id":26771679,"avatar_url":"https://avatars1.githubusercontent.com/u/26771679?v=4","gravatar_id":"","url":"https://api.github.com/users/apim-haufe-io","html_url":"https://github.com/apim-haufe-io","followers_url":"https://api.github.com/users/apim-haufe-io/followers","following_url":"https://api.github.com/users/apim-haufe-io/following{/other_user}","gists_url":"https://api.github.com/users/apim-haufe-io/gists{/gist_id}","starred_url":"https://api.github.com/users/apim-haufe-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apim-haufe-io/subscriptions","organizations_url":"https://api.github.com/users/apim-haufe-io/orgs","repos_url":"https://api.github.com/users/apim-haufe-io/repos","events_url":"https://api.github.com/users/apim-haufe-io/events{/privacy}","received_events_url":"https://api.github.com/users/apim-haufe-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apim-haufe-io/wicked.portal","description":"wicked.haufe.io - API Portal UI service","fork":false,"url":"https://api.github.com/repos/apim-haufe-io/wicked.portal","forks_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/forks","keys_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/teams","hooks_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/hooks","issue_events_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/issues/events{/number}","events_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/events","assignees_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/assignees{/user}","branches_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/branches{/branch}","tags_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/tags","blobs_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/statuses/{sha}","languages_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/languages","stargazers_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/stargazers","contributors_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/contributors","subscribers_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/subscribers","subscription_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/subscription","commits_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/contents/{+path}","compare_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/merges","archive_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/downloads","issues_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/issues{/number}","pulls_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls{/number}","milestones_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/milestones{/number}","notifications_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/labels{/name}","releases_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/releases{/id}","deployments_url":"https://api.github.com/repos/apim-haufe-io/wicked.portal/deployments","created_at":"2016-08-05T14:21:31Z","updated_at":"2017-08-31T08:24:07Z","pushed_at":"2017-12-14T19:33:12Z","git_url":"git://github.com/apim-haufe-io/wicked.portal.git","ssh_url":"git@github.com:apim-haufe-io/wicked.portal.git","clone_url":"https://github.com/apim-haufe-io/wicked.portal.git","svn_url":"https://github.com/apim-haufe-io/wicked.portal","homepage":null,"size":386,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":8,"open_issues":2,"watchers":0,"default_branch":"next"}},"_links":{"self":{"href":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/11"},"html":{"href":"https://github.com/apim-haufe-io/wicked.portal/pull/11"},"issue":{"href":"https://api.github.com/repos/apim-haufe-io/wicked.portal/issues/11"},"comments":{"href":"https://api.github.com/repos/apim-haufe-io/wicked.portal/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apim-haufe-io/wicked.portal/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/apim-haufe-io/wicked.portal/statuses/f777d57f13cee35ce138ace9020356dd2fa79578"}},"author_association":"NONE"}}
{"actor":{"display_login":"santokhsingh"}}