{"action":"created","comment":{"url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/comments/24439581","id":24439581,"diff_hunk":"@@ -124,6 +135,19 @@ public int insertToken(AuthToken token) {\n \t\t\tresult = session.insert(TOKEN_MAPPER_PACKAGE + \".insertToken\", token);\n \t\t\tsession.commit();\n \t\t}\n+\t\tAuthToken savedToken = getByTokenById(token.getTokenId());\n+\t\tif (null != savedToken) {\n+\t\t\tBigInteger savedTokenId = savedToken.getId();\n+\t\t\ttry (SqlSession session = sqlSessionFactory.openSession()) {\n+\t\t\t\tfor (String role : token.getRoles()) {\n+\t\t\t\t\tMap<String, Object> map = new HashMap<String, Object>();\n+\t\t\t\t\tmap.put(\"id\", savedTokenId);\n+\t\t\t\t\tmap.put(\"roleName\", role);\n+\t\t\t\t\tresult = session.insert(TOKEN_MAPPER_PACKAGE + \".insertRole\", map);\n+\t\t\t\t}\n+\t\t\t\tsession.commit();","path":"auth-database/src/main/java/gov/usgs/cida/auth/dao/AuthTokenDAO.java","position":64,"original_position":64,"commit_id":"411dcde5c7ed7b67a655a10c161c42d70de0815c","original_commit_id":"411dcde5c7ed7b67a655a10c161c42d70de0815c","user":{"login":"isuftin","id":928288,"avatar_url":"https://avatars.githubusercontent.com/u/928288?v=3","gravatar_id":"","url":"https://api.github.com/users/isuftin","html_url":"https://github.com/isuftin","followers_url":"https://api.github.com/users/isuftin/followers","following_url":"https://api.github.com/users/isuftin/following{/other_user}","gists_url":"https://api.github.com/users/isuftin/gists{/gist_id}","starred_url":"https://api.github.com/users/isuftin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isuftin/subscriptions","organizations_url":"https://api.github.com/users/isuftin/orgs","repos_url":"https://api.github.com/users/isuftin/repos","events_url":"https://api.github.com/users/isuftin/events{/privacy}","received_events_url":"https://api.github.com/users/isuftin/received_events","type":"User","site_admin":false},"body":"Does this need to be in a try / catch for rollback?","created_at":"2015-02-10T19:00:24Z","updated_at":"2015-02-10T19:00:24Z","html_url":"https://github.com/USGS-CIDA/cida-auth/pull/44#discussion_r24439581","pull_request_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/44","_links":{"self":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/comments/24439581"},"html":{"href":"https://github.com/USGS-CIDA/cida-auth/pull/44#discussion_r24439581"},"pull_request":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/44"}}},"pull_request":{"url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/44","id":29029259,"html_url":"https://github.com/USGS-CIDA/cida-auth/pull/44","diff_url":"https://github.com/USGS-CIDA/cida-auth/pull/44.diff","patch_url":"https://github.com/USGS-CIDA/cida-auth/pull/44.patch","issue_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/44","number":44,"state":"open","locked":false,"title":"storing roles with tokens to allow both implementations to work the same","user":{"login":"instantsoup","id":6976939,"avatar_url":"https://avatars.githubusercontent.com/u/6976939?v=3","gravatar_id":"","url":"https://api.github.com/users/instantsoup","html_url":"https://github.com/instantsoup","followers_url":"https://api.github.com/users/instantsoup/followers","following_url":"https://api.github.com/users/instantsoup/following{/other_user}","gists_url":"https://api.github.com/users/instantsoup/gists{/gist_id}","starred_url":"https://api.github.com/users/instantsoup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/instantsoup/subscriptions","organizations_url":"https://api.github.com/users/instantsoup/orgs","repos_url":"https://api.github.com/users/instantsoup/repos","events_url":"https://api.github.com/users/instantsoup/events{/privacy}","received_events_url":"https://api.github.com/users/instantsoup/received_events","type":"User","site_admin":false},"body":"way","created_at":"2015-02-10T17:56:19Z","updated_at":"2015-02-10T19:00:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6bdaeb21a0043172444ab514198dd0968f80be15","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/44/commits","review_comments_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/44/comments","review_comment_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/comments/{number}","comments_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/44/comments","statuses_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/statuses/411dcde5c7ed7b67a655a10c161c42d70de0815c","head":{"label":"instantsoup:master","ref":"master","sha":"411dcde5c7ed7b67a655a10c161c42d70de0815c","user":{"login":"instantsoup","id":6976939,"avatar_url":"https://avatars.githubusercontent.com/u/6976939?v=3","gravatar_id":"","url":"https://api.github.com/users/instantsoup","html_url":"https://github.com/instantsoup","followers_url":"https://api.github.com/users/instantsoup/followers","following_url":"https://api.github.com/users/instantsoup/following{/other_user}","gists_url":"https://api.github.com/users/instantsoup/gists{/gist_id}","starred_url":"https://api.github.com/users/instantsoup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/instantsoup/subscriptions","organizations_url":"https://api.github.com/users/instantsoup/orgs","repos_url":"https://api.github.com/users/instantsoup/repos","events_url":"https://api.github.com/users/instantsoup/events{/privacy}","received_events_url":"https://api.github.com/users/instantsoup/received_events","type":"User","site_admin":false},"repo":{"id":29690120,"name":"cida-auth","full_name":"instantsoup/cida-auth","owner":{"login":"instantsoup","id":6976939,"avatar_url":"https://avatars.githubusercontent.com/u/6976939?v=3","gravatar_id":"","url":"https://api.github.com/users/instantsoup","html_url":"https://github.com/instantsoup","followers_url":"https://api.github.com/users/instantsoup/followers","following_url":"https://api.github.com/users/instantsoup/following{/other_user}","gists_url":"https://api.github.com/users/instantsoup/gists{/gist_id}","starred_url":"https://api.github.com/users/instantsoup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/instantsoup/subscriptions","organizations_url":"https://api.github.com/users/instantsoup/orgs","repos_url":"https://api.github.com/users/instantsoup/repos","events_url":"https://api.github.com/users/instantsoup/events{/privacy}","received_events_url":"https://api.github.com/users/instantsoup/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/instantsoup/cida-auth","description":"A collection of modules dealing with authentication and authorization","fork":true,"url":"https://api.github.com/repos/instantsoup/cida-auth","forks_url":"https://api.github.com/repos/instantsoup/cida-auth/forks","keys_url":"https://api.github.com/repos/instantsoup/cida-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/instantsoup/cida-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/instantsoup/cida-auth/teams","hooks_url":"https://api.github.com/repos/instantsoup/cida-auth/hooks","issue_events_url":"https://api.github.com/repos/instantsoup/cida-auth/issues/events{/number}","events_url":"https://api.github.com/repos/instantsoup/cida-auth/events","assignees_url":"https://api.github.com/repos/instantsoup/cida-auth/assignees{/user}","branches_url":"https://api.github.com/repos/instantsoup/cida-auth/branches{/branch}","tags_url":"https://api.github.com/repos/instantsoup/cida-auth/tags","blobs_url":"https://api.github.com/repos/instantsoup/cida-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/instantsoup/cida-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/instantsoup/cida-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/instantsoup/cida-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/instantsoup/cida-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/instantsoup/cida-auth/languages","stargazers_url":"https://api.github.com/repos/instantsoup/cida-auth/stargazers","contributors_url":"https://api.github.com/repos/instantsoup/cida-auth/contributors","subscribers_url":"https://api.github.com/repos/instantsoup/cida-auth/subscribers","subscription_url":"https://api.github.com/repos/instantsoup/cida-auth/subscription","commits_url":"https://api.github.com/repos/instantsoup/cida-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/instantsoup/cida-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/instantsoup/cida-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/instantsoup/cida-auth/issues/comments/{number}","contents_url":"https://api.github.com/repos/instantsoup/cida-auth/contents/{+path}","compare_url":"https://api.github.com/repos/instantsoup/cida-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/instantsoup/cida-auth/merges","archive_url":"https://api.github.com/repos/instantsoup/cida-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/instantsoup/cida-auth/downloads","issues_url":"https://api.github.com/repos/instantsoup/cida-auth/issues{/number}","pulls_url":"https://api.github.com/repos/instantsoup/cida-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/instantsoup/cida-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/instantsoup/cida-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/instantsoup/cida-auth/labels{/name}","releases_url":"https://api.github.com/repos/instantsoup/cida-auth/releases{/id}","created_at":"2015-01-22T17:14:15Z","updated_at":"2015-02-10T17:55:14Z","pushed_at":"2015-02-10T17:55:14Z","git_url":"git://github.com/instantsoup/cida-auth.git","ssh_url":"git@github.com:instantsoup/cida-auth.git","clone_url":"https://github.com/instantsoup/cida-auth.git","svn_url":"https://github.com/instantsoup/cida-auth","homepage":"","size":338,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"master"}},"base":{"label":"USGS-CIDA:master","ref":"master","sha":"b8ca1f23c5a7eeae4834a9a5843b0f767eee3702","user":{"login":"USGS-CIDA","id":918179,"avatar_url":"https://avatars.githubusercontent.com/u/918179?v=3","gravatar_id":"","url":"https://api.github.com/users/USGS-CIDA","html_url":"https://github.com/USGS-CIDA","followers_url":"https://api.github.com/users/USGS-CIDA/followers","following_url":"https://api.github.com/users/USGS-CIDA/following{/other_user}","gists_url":"https://api.github.com/users/USGS-CIDA/gists{/gist_id}","starred_url":"https://api.github.com/users/USGS-CIDA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/USGS-CIDA/subscriptions","organizations_url":"https://api.github.com/users/USGS-CIDA/orgs","repos_url":"https://api.github.com/users/USGS-CIDA/repos","events_url":"https://api.github.com/users/USGS-CIDA/events{/privacy}","received_events_url":"https://api.github.com/users/USGS-CIDA/received_events","type":"Organization","site_admin":false},"repo":{"id":23077505,"name":"cida-auth","full_name":"USGS-CIDA/cida-auth","owner":{"login":"USGS-CIDA","id":918179,"avatar_url":"https://avatars.githubusercontent.com/u/918179?v=3","gravatar_id":"","url":"https://api.github.com/users/USGS-CIDA","html_url":"https://github.com/USGS-CIDA","followers_url":"https://api.github.com/users/USGS-CIDA/followers","following_url":"https://api.github.com/users/USGS-CIDA/following{/other_user}","gists_url":"https://api.github.com/users/USGS-CIDA/gists{/gist_id}","starred_url":"https://api.github.com/users/USGS-CIDA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/USGS-CIDA/subscriptions","organizations_url":"https://api.github.com/users/USGS-CIDA/orgs","repos_url":"https://api.github.com/users/USGS-CIDA/repos","events_url":"https://api.github.com/users/USGS-CIDA/events{/privacy}","received_events_url":"https://api.github.com/users/USGS-CIDA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/USGS-CIDA/cida-auth","description":"A collection of modules dealing with authentication and authorization","fork":false,"url":"https://api.github.com/repos/USGS-CIDA/cida-auth","forks_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/forks","keys_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/teams","hooks_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/hooks","issue_events_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/events{/number}","events_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/events","assignees_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/assignees{/user}","branches_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/branches{/branch}","tags_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/tags","blobs_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/languages","stargazers_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/stargazers","contributors_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/contributors","subscribers_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/subscribers","subscription_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/subscription","commits_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/comments/{number}","contents_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/contents/{+path}","compare_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/merges","archive_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/downloads","issues_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues{/number}","pulls_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/labels{/name}","releases_url":"https://api.github.com/repos/USGS-CIDA/cida-auth/releases{/id}","created_at":"2014-08-18T16:01:18Z","updated_at":"2015-02-06T16:21:00Z","pushed_at":"2015-02-06T16:21:00Z","git_url":"git://github.com/USGS-CIDA/cida-auth.git","ssh_url":"git@github.com:USGS-CIDA/cida-auth.git","clone_url":"https://github.com/USGS-CIDA/cida-auth.git","svn_url":"https://github.com/USGS-CIDA/cida-auth","homepage":"","size":570,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/44"},"html":{"href":"https://github.com/USGS-CIDA/cida-auth/pull/44"},"issue":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/44"},"comments":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/USGS-CIDA/cida-auth/statuses/411dcde5c7ed7b67a655a10c161c42d70de0815c"}}}}