{"action":"created","comment":{"url":"https://api.github.com/repos/ga4gh/dockstore/pulls/comments/207309524","pull_request_review_id":142896707,"id":207309524,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzMwOTUyNA==","diff_hunk":"@@ -321,34 +335,52 @@ public Token addGoogleToken(@ApiParam(hidden = true) @Auth Optional<User> authUs\n         Token dockstoreToken = null;\n         Token googleToken = null;\n         String googleLoginName = userinfo.getEmail();\n-        User user = userDAO.findByUsername(googleLoginName);\n-\n-        List<Token> googleByUsername = tokenDAO.findTokenByUsername(userinfo.getEmail(), TokenType.GOOGLE_COM);\n-        if (user == null && !authUser.isPresent() && googleByUsername.isEmpty()) {\n-            user = new User();\n-            // Pull user information from Google\n-            user.setUsername(userinfo.getEmail());\n-            userID = userDAO.create(user);\n-\n-            // CREATE DOCKSTORE TOKEN\n-            dockstoreToken = createDockstoreToken(userID, googleLoginName);\n+        User user;\n+        User googleUser;\n+        googleUser = userDAO.findByUsername(googleLoginName);\n+        List<Token> tokensByGoogleUsername = tokenDAO.findTokenByUsername(userinfo.getEmail(), TokenType.GOOGLE_COM);\n+        if (authUser.isPresent()) {","path":"dockstore-webservice/src/main/java/io/dockstore/webservice/resources/TokenResource.java","position":42,"original_position":42,"commit_id":"ff7a0067b1765ec8bd3fd28df29a5edd8344a276","original_commit_id":"ff7a0067b1765ec8bd3fd28df29a5edd8344a276","user":{"login":"garyluu","id":24548904,"node_id":"MDQ6VXNlcjI0NTQ4OTA0","avatar_url":"https://avatars3.githubusercontent.com/u/24548904?v=4","gravatar_id":"","url":"https://api.github.com/users/garyluu","html_url":"https://github.com/garyluu","followers_url":"https://api.github.com/users/garyluu/followers","following_url":"https://api.github.com/users/garyluu/following{/other_user}","gists_url":"https://api.github.com/users/garyluu/gists{/gist_id}","starred_url":"https://api.github.com/users/garyluu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyluu/subscriptions","organizations_url":"https://api.github.com/users/garyluu/orgs","repos_url":"https://api.github.com/users/garyluu/repos","events_url":"https://api.github.com/users/garyluu/events{/privacy}","received_events_url":"https://api.github.com/users/garyluu/received_events","type":"User","site_admin":false},"body":"Yes, i was considering doing something that like in the beginning but decided against it because of the dockstore token.  There's an IDE error or at least a warning when userId is possibly not initialized, so i wasn't really worried about that.","created_at":"2018-08-02T17:27:07Z","updated_at":"2018-08-02T17:27:08Z","html_url":"https://github.com/ga4gh/dockstore/pull/1676#discussion_r207309524","pull_request_url":"https://api.github.com/repos/ga4gh/dockstore/pulls/1676","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/comments/207309524"},"html":{"href":"https://github.com/ga4gh/dockstore/pull/1676#discussion_r207309524"},"pull_request":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/1676"}},"in_reply_to_id":207304636},"pull_request":{"url":"https://api.github.com/repos/ga4gh/dockstore/pulls/1676","id":205768085,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1NzY4MDg1","html_url":"https://github.com/ga4gh/dockstore/pull/1676","diff_url":"https://github.com/ga4gh/dockstore/pull/1676.diff","patch_url":"https://github.com/ga4gh/dockstore/pull/1676.patch","issue_url":"https://api.github.com/repos/ga4gh/dockstore/issues/1676","number":1676,"state":"open","locked":false,"title":"Feature/1370/token check","user":{"login":"garyluu","id":24548904,"node_id":"MDQ6VXNlcjI0NTQ4OTA0","avatar_url":"https://avatars3.githubusercontent.com/u/24548904?v=4","gravatar_id":"","url":"https://api.github.com/users/garyluu","html_url":"https://github.com/garyluu","followers_url":"https://api.github.com/users/garyluu/followers","following_url":"https://api.github.com/users/garyluu/following{/other_user}","gists_url":"https://api.github.com/users/garyluu/gists{/gist_id}","starred_url":"https://api.github.com/users/garyluu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyluu/subscriptions","organizations_url":"https://api.github.com/users/garyluu/orgs","repos_url":"https://api.github.com/users/garyluu/repos","events_url":"https://api.github.com/users/garyluu/events{/privacy}","received_events_url":"https://api.github.com/users/garyluu/received_events","type":"User","site_admin":false},"body":"- Add constraint to prevent orphaned tokens\r\n- Change google login logic.  Choosing which account to log into with \"Login with Google\" is now somewhat possible.  Basically...in order of priority: goes to account with google token, if both have token or both have no google token, then choose Google account. See the table in the code comments for more info.\r\n\r\nFor end users: \"Login with Google\" will prioritize logging into an existing account that has a Google token\r\nFor issue #1370 followup","created_at":"2018-08-02T15:08:00Z","updated_at":"2018-08-02T17:27:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"90260f386db6a365006a7132117440a1c95cf5f5","assignee":{"login":"garyluu","id":24548904,"node_id":"MDQ6VXNlcjI0NTQ4OTA0","avatar_url":"https://avatars3.githubusercontent.com/u/24548904?v=4","gravatar_id":"","url":"https://api.github.com/users/garyluu","html_url":"https://github.com/garyluu","followers_url":"https://api.github.com/users/garyluu/followers","following_url":"https://api.github.com/users/garyluu/following{/other_user}","gists_url":"https://api.github.com/users/garyluu/gists{/gist_id}","starred_url":"https://api.github.com/users/garyluu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyluu/subscriptions","organizations_url":"https://api.github.com/users/garyluu/orgs","repos_url":"https://api.github.com/users/garyluu/repos","events_url":"https://api.github.com/users/garyluu/events{/privacy}","received_events_url":"https://api.github.com/users/garyluu/received_events","type":"User","site_admin":false},"assignees":[{"login":"garyluu","id":24548904,"node_id":"MDQ6VXNlcjI0NTQ4OTA0","avatar_url":"https://avatars3.githubusercontent.com/u/24548904?v=4","gravatar_id":"","url":"https://api.github.com/users/garyluu","html_url":"https://github.com/garyluu","followers_url":"https://api.github.com/users/garyluu/followers","following_url":"https://api.github.com/users/garyluu/following{/other_user}","gists_url":"https://api.github.com/users/garyluu/gists{/gist_id}","starred_url":"https://api.github.com/users/garyluu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyluu/subscriptions","organizations_url":"https://api.github.com/users/garyluu/orgs","repos_url":"https://api.github.com/users/garyluu/repos","events_url":"https://api.github.com/users/garyluu/events{/privacy}","received_events_url":"https://api.github.com/users/garyluu/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"denis-yuen","id":1730679,"node_id":"MDQ6VXNlcjE3MzA2Nzk=","avatar_url":"https://avatars0.githubusercontent.com/u/1730679?v=4","gravatar_id":"","url":"https://api.github.com/users/denis-yuen","html_url":"https://github.com/denis-yuen","followers_url":"https://api.github.com/users/denis-yuen/followers","following_url":"https://api.github.com/users/denis-yuen/following{/other_user}","gists_url":"https://api.github.com/users/denis-yuen/gists{/gist_id}","starred_url":"https://api.github.com/users/denis-yuen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denis-yuen/subscriptions","organizations_url":"https://api.github.com/users/denis-yuen/orgs","repos_url":"https://api.github.com/users/denis-yuen/repos","events_url":"https://api.github.com/users/denis-yuen/events{/privacy}","received_events_url":"https://api.github.com/users/denis-yuen/received_events","type":"User","site_admin":false},{"login":"agduncan94","id":6331159,"node_id":"MDQ6VXNlcjYzMzExNTk=","avatar_url":"https://avatars2.githubusercontent.com/u/6331159?v=4","gravatar_id":"","url":"https://api.github.com/users/agduncan94","html_url":"https://github.com/agduncan94","followers_url":"https://api.github.com/users/agduncan94/followers","following_url":"https://api.github.com/users/agduncan94/following{/other_user}","gists_url":"https://api.github.com/users/agduncan94/gists{/gist_id}","starred_url":"https://api.github.com/users/agduncan94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agduncan94/subscriptions","organizations_url":"https://api.github.com/users/agduncan94/orgs","repos_url":"https://api.github.com/users/agduncan94/repos","events_url":"https://api.github.com/users/agduncan94/events{/privacy}","received_events_url":"https://api.github.com/users/agduncan94/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ga4gh/dockstore/pulls/1676/commits","review_comments_url":"https://api.github.com/repos/ga4gh/dockstore/pulls/1676/comments","review_comment_url":"https://api.github.com/repos/ga4gh/dockstore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ga4gh/dockstore/issues/1676/comments","statuses_url":"https://api.github.com/repos/ga4gh/dockstore/statuses/ff7a0067b1765ec8bd3fd28df29a5edd8344a276","head":{"label":"ga4gh:feature/1370/tokenCheck","ref":"feature/1370/tokenCheck","sha":"ff7a0067b1765ec8bd3fd28df29a5edd8344a276","user":{"login":"ga4gh","id":6921777,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5MjE3Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/6921777?v=4","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"repo":{"id":33383826,"node_id":"MDEwOlJlcG9zaXRvcnkzMzM4MzgyNg==","name":"dockstore","full_name":"ga4gh/dockstore","owner":{"login":"ga4gh","id":6921777,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5MjE3Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/6921777?v=4","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ga4gh/dockstore","description":"Our VM/Docker sharing infrastructure and management component","fork":false,"url":"https://api.github.com/repos/ga4gh/dockstore","forks_url":"https://api.github.com/repos/ga4gh/dockstore/forks","keys_url":"https://api.github.com/repos/ga4gh/dockstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ga4gh/dockstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ga4gh/dockstore/teams","hooks_url":"https://api.github.com/repos/ga4gh/dockstore/hooks","issue_events_url":"https://api.github.com/repos/ga4gh/dockstore/issues/events{/number}","events_url":"https://api.github.com/repos/ga4gh/dockstore/events","assignees_url":"https://api.github.com/repos/ga4gh/dockstore/assignees{/user}","branches_url":"https://api.github.com/repos/ga4gh/dockstore/branches{/branch}","tags_url":"https://api.github.com/repos/ga4gh/dockstore/tags","blobs_url":"https://api.github.com/repos/ga4gh/dockstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ga4gh/dockstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ga4gh/dockstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/ga4gh/dockstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ga4gh/dockstore/statuses/{sha}","languages_url":"https://api.github.com/repos/ga4gh/dockstore/languages","stargazers_url":"https://api.github.com/repos/ga4gh/dockstore/stargazers","contributors_url":"https://api.github.com/repos/ga4gh/dockstore/contributors","subscribers_url":"https://api.github.com/repos/ga4gh/dockstore/subscribers","subscription_url":"https://api.github.com/repos/ga4gh/dockstore/subscription","commits_url":"https://api.github.com/repos/ga4gh/dockstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/ga4gh/dockstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/ga4gh/dockstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/ga4gh/dockstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/ga4gh/dockstore/contents/{+path}","compare_url":"https://api.github.com/repos/ga4gh/dockstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ga4gh/dockstore/merges","archive_url":"https://api.github.com/repos/ga4gh/dockstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ga4gh/dockstore/downloads","issues_url":"https://api.github.com/repos/ga4gh/dockstore/issues{/number}","pulls_url":"https://api.github.com/repos/ga4gh/dockstore/pulls{/number}","milestones_url":"https://api.github.com/repos/ga4gh/dockstore/milestones{/number}","notifications_url":"https://api.github.com/repos/ga4gh/dockstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ga4gh/dockstore/labels{/name}","releases_url":"https://api.github.com/repos/ga4gh/dockstore/releases{/id}","deployments_url":"https://api.github.com/repos/ga4gh/dockstore/deployments","created_at":"2015-04-03T21:34:05Z","updated_at":"2018-08-02T14:31:09Z","pushed_at":"2018-08-02T16:00:25Z","git_url":"git://github.com/ga4gh/dockstore.git","ssh_url":"git@github.com:ga4gh/dockstore.git","clone_url":"https://github.com/ga4gh/dockstore.git","svn_url":"https://github.com/ga4gh/dockstore","homepage":"https://dockstore.org/","size":19253,"stargazers_count":52,"watchers_count":52,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"archived":false,"open_issues_count":307,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":16,"open_issues":307,"watchers":52,"default_branch":"develop"}},"base":{"label":"ga4gh:develop","ref":"develop","sha":"b0ea911580426783a196a4e554104ad8c331f81f","user":{"login":"ga4gh","id":6921777,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5MjE3Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/6921777?v=4","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"repo":{"id":33383826,"node_id":"MDEwOlJlcG9zaXRvcnkzMzM4MzgyNg==","name":"dockstore","full_name":"ga4gh/dockstore","owner":{"login":"ga4gh","id":6921777,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5MjE3Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/6921777?v=4","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ga4gh/dockstore","description":"Our VM/Docker sharing infrastructure and management component","fork":false,"url":"https://api.github.com/repos/ga4gh/dockstore","forks_url":"https://api.github.com/repos/ga4gh/dockstore/forks","keys_url":"https://api.github.com/repos/ga4gh/dockstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ga4gh/dockstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ga4gh/dockstore/teams","hooks_url":"https://api.github.com/repos/ga4gh/dockstore/hooks","issue_events_url":"https://api.github.com/repos/ga4gh/dockstore/issues/events{/number}","events_url":"https://api.github.com/repos/ga4gh/dockstore/events","assignees_url":"https://api.github.com/repos/ga4gh/dockstore/assignees{/user}","branches_url":"https://api.github.com/repos/ga4gh/dockstore/branches{/branch}","tags_url":"https://api.github.com/repos/ga4gh/dockstore/tags","blobs_url":"https://api.github.com/repos/ga4gh/dockstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ga4gh/dockstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ga4gh/dockstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/ga4gh/dockstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ga4gh/dockstore/statuses/{sha}","languages_url":"https://api.github.com/repos/ga4gh/dockstore/languages","stargazers_url":"https://api.github.com/repos/ga4gh/dockstore/stargazers","contributors_url":"https://api.github.com/repos/ga4gh/dockstore/contributors","subscribers_url":"https://api.github.com/repos/ga4gh/dockstore/subscribers","subscription_url":"https://api.github.com/repos/ga4gh/dockstore/subscription","commits_url":"https://api.github.com/repos/ga4gh/dockstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/ga4gh/dockstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/ga4gh/dockstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/ga4gh/dockstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/ga4gh/dockstore/contents/{+path}","compare_url":"https://api.github.com/repos/ga4gh/dockstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ga4gh/dockstore/merges","archive_url":"https://api.github.com/repos/ga4gh/dockstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ga4gh/dockstore/downloads","issues_url":"https://api.github.com/repos/ga4gh/dockstore/issues{/number}","pulls_url":"https://api.github.com/repos/ga4gh/dockstore/pulls{/number}","milestones_url":"https://api.github.com/repos/ga4gh/dockstore/milestones{/number}","notifications_url":"https://api.github.com/repos/ga4gh/dockstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ga4gh/dockstore/labels{/name}","releases_url":"https://api.github.com/repos/ga4gh/dockstore/releases{/id}","deployments_url":"https://api.github.com/repos/ga4gh/dockstore/deployments","created_at":"2015-04-03T21:34:05Z","updated_at":"2018-08-02T14:31:09Z","pushed_at":"2018-08-02T16:00:25Z","git_url":"git://github.com/ga4gh/dockstore.git","ssh_url":"git@github.com:ga4gh/dockstore.git","clone_url":"https://github.com/ga4gh/dockstore.git","svn_url":"https://github.com/ga4gh/dockstore","homepage":"https://dockstore.org/","size":19253,"stargazers_count":52,"watchers_count":52,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"archived":false,"open_issues_count":307,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":16,"open_issues":307,"watchers":52,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/1676"},"html":{"href":"https://github.com/ga4gh/dockstore/pull/1676"},"issue":{"href":"https://api.github.com/repos/ga4gh/dockstore/issues/1676"},"comments":{"href":"https://api.github.com/repos/ga4gh/dockstore/issues/1676/comments"},"review_comments":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/1676/comments"},"review_comment":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ga4gh/dockstore/pulls/1676/commits"},"statuses":{"href":"https://api.github.com/repos/ga4gh/dockstore/statuses/ff7a0067b1765ec8bd3fd28df29a5edd8344a276"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"garyluu"}}