{"action":"created","comment":{"url":"https://api.github.com/repos/codice/ddf/pulls/comments/65228125","id":65228125,"diff_hunk":"@@ -193,4 +201,38 @@ public static String getEmailAddress(Subject subject) {\n                 .findFirst()\n                 .orElse(null);\n     }\n+\n+    public static final List<String> getRoles(Subject subject) {\n+        if (subject == null) {\n+            LOGGER.debug(\"Incoming subject was null, cannot look up email address.\");\n+            return Collections.emptyList();\n+        }\n+\n+        PrincipalCollection principals = subject.getPrincipals();\n+        if (principals == null) {\n+            LOGGER.debug(\n+                    \"No principals located in the incoming subject, cannot look up email address.\");\n+            return Collections.emptyList();\n+        }\n+\n+        SecurityAssertion assertion = principals.oneByType(SecurityAssertion.class);\n+        if (assertion == null) {\n+            LOGGER.debug(\"Could not find Security Assertion, cannot look up email address\");\n+            return Collections.emptyList();\n+        }\n+\n+        Set<String> roles = assertion.getAttributeStatements()\n+                .stream()\n+                .flatMap(as -> as.getAttributes()\n+                        .stream())\n+                .filter(a -> ROLE_CLAIM_URI.equals(a.getName()))\n+                .flatMap(a -> a.getAttributeValues()\n+                        .stream())\n+                .filter(o -> o instanceof XSString)\n+                .map(o -> (XSString) o)\n+                .map(XSString::getValue)\n+                .collect(Collectors.toSet());","path":"platform/security/platform-security-core-api/src/main/java/ddf/security/SubjectUtils.java","position":59,"original_position":59,"commit_id":"6a94ae3607cf6fced7b7aac8f3d759d09f17d16c","original_commit_id":"6a94ae3607cf6fced7b7aac8f3d759d09f17d16c","user":{"login":"stustison","id":4391679,"avatar_url":"https://avatars.githubusercontent.com/u/4391679?v=3","gravatar_id":"","url":"https://api.github.com/users/stustison","html_url":"https://github.com/stustison","followers_url":"https://api.github.com/users/stustison/followers","following_url":"https://api.github.com/users/stustison/following{/other_user}","gists_url":"https://api.github.com/users/stustison/gists{/gist_id}","starred_url":"https://api.github.com/users/stustison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stustison/subscriptions","organizations_url":"https://api.github.com/users/stustison/orgs","repos_url":"https://api.github.com/users/stustison/repos","events_url":"https://api.github.com/users/stustison/events{/privacy}","received_events_url":"https://api.github.com/users/stustison/received_events","type":"User","site_admin":false},"body":"Why not just return the Set and avoid the copy over into the List?","created_at":"2016-05-31T17:36:52Z","updated_at":"2016-05-31T17:36:52Z","html_url":"https://github.com/codice/ddf/pull/830#discussion_r65228125","pull_request_url":"https://api.github.com/repos/codice/ddf/pulls/830","_links":{"self":{"href":"https://api.github.com/repos/codice/ddf/pulls/comments/65228125"},"html":{"href":"https://github.com/codice/ddf/pull/830#discussion_r65228125"},"pull_request":{"href":"https://api.github.com/repos/codice/ddf/pulls/830"}}},"pull_request":{"url":"https://api.github.com/repos/codice/ddf/pulls/830","id":72055200,"html_url":"https://github.com/codice/ddf/pull/830","diff_url":"https://github.com/codice/ddf/pull/830.diff","patch_url":"https://github.com/codice/ddf/pull/830.patch","issue_url":"https://api.github.com/repos/codice/ddf/issues/830","number":830,"state":"open","locked":false,"title":"DDF-2159: Added a new SubjectUtils helper for getting subject roles.","user":{"login":"djblue","id":1986211,"avatar_url":"https://avatars.githubusercontent.com/u/1986211?v=3","gravatar_id":"","url":"https://api.github.com/users/djblue","html_url":"https://github.com/djblue","followers_url":"https://api.github.com/users/djblue/followers","following_url":"https://api.github.com/users/djblue/following{/other_user}","gists_url":"https://api.github.com/users/djblue/gists{/gist_id}","starred_url":"https://api.github.com/users/djblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djblue/subscriptions","organizations_url":"https://api.github.com/users/djblue/orgs","repos_url":"https://api.github.com/users/djblue/repos","events_url":"https://api.github.com/users/djblue/events{/privacy}","received_events_url":"https://api.github.com/users/djblue/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\n\r\nAdds a new SubjectUtils helper for getting subject roles.\r\n\r\n#### Who is reviewing it (please choose AT LEAST two reviewers that need to approve the PR before it can get merged; if a component team is listed, at least one of its members needs to approve)?\r\n\r\n@pklinef \r\n@rzwiefel \r\n\r\n#### Choose 2 committers to review/merge the PR (please choose ONLY two committers from below, delete the rest).\r\n\r\n@kcwire \r\n@stustison\r\n\r\n#### How should this be tested?\r\n\r\nBuild passes.\r\n\r\n#### What are the relevant tickets?\r\n\r\n[DDF-2159](https://codice.atlassian.net/browse/DDF-2159)\r\n\r\n#### Checklist:\r\n- [ ] Documentation Updated\r\n- [ ] Update / Add Unit Tests\r\n- [ ] Update / Add Integration Tests\r\n","created_at":"2016-05-31T17:32:25Z","updated_at":"2016-05-31T17:36:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1d12bae08a18120ad2e02322960f42dd018f813","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/codice/ddf/pulls/830/commits","review_comments_url":"https://api.github.com/repos/codice/ddf/pulls/830/comments","review_comment_url":"https://api.github.com/repos/codice/ddf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codice/ddf/issues/830/comments","statuses_url":"https://api.github.com/repos/codice/ddf/statuses/6a94ae3607cf6fced7b7aac8f3d759d09f17d16c","head":{"label":"djblue:DDF-2159","ref":"DDF-2159","sha":"6a94ae3607cf6fced7b7aac8f3d759d09f17d16c","user":{"login":"djblue","id":1986211,"avatar_url":"https://avatars.githubusercontent.com/u/1986211?v=3","gravatar_id":"","url":"https://api.github.com/users/djblue","html_url":"https://github.com/djblue","followers_url":"https://api.github.com/users/djblue/followers","following_url":"https://api.github.com/users/djblue/following{/other_user}","gists_url":"https://api.github.com/users/djblue/gists{/gist_id}","starred_url":"https://api.github.com/users/djblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djblue/subscriptions","organizations_url":"https://api.github.com/users/djblue/orgs","repos_url":"https://api.github.com/users/djblue/repos","events_url":"https://api.github.com/users/djblue/events{/privacy}","received_events_url":"https://api.github.com/users/djblue/received_events","type":"User","site_admin":false},"repo":{"id":37468193,"name":"ddf","full_name":"djblue/ddf","owner":{"login":"djblue","id":1986211,"avatar_url":"https://avatars.githubusercontent.com/u/1986211?v=3","gravatar_id":"","url":"https://api.github.com/users/djblue","html_url":"https://github.com/djblue","followers_url":"https://api.github.com/users/djblue/followers","following_url":"https://api.github.com/users/djblue/following{/other_user}","gists_url":"https://api.github.com/users/djblue/gists{/gist_id}","starred_url":"https://api.github.com/users/djblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djblue/subscriptions","organizations_url":"https://api.github.com/users/djblue/orgs","repos_url":"https://api.github.com/users/djblue/repos","events_url":"https://api.github.com/users/djblue/events{/privacy}","received_events_url":"https://api.github.com/users/djblue/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/djblue/ddf","description":"The Distributed Data Framework - Distribution, SDK, and Test","fork":true,"url":"https://api.github.com/repos/djblue/ddf","forks_url":"https://api.github.com/repos/djblue/ddf/forks","keys_url":"https://api.github.com/repos/djblue/ddf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/djblue/ddf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/djblue/ddf/teams","hooks_url":"https://api.github.com/repos/djblue/ddf/hooks","issue_events_url":"https://api.github.com/repos/djblue/ddf/issues/events{/number}","events_url":"https://api.github.com/repos/djblue/ddf/events","assignees_url":"https://api.github.com/repos/djblue/ddf/assignees{/user}","branches_url":"https://api.github.com/repos/djblue/ddf/branches{/branch}","tags_url":"https://api.github.com/repos/djblue/ddf/tags","blobs_url":"https://api.github.com/repos/djblue/ddf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/djblue/ddf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/djblue/ddf/git/refs{/sha}","trees_url":"https://api.github.com/repos/djblue/ddf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/djblue/ddf/statuses/{sha}","languages_url":"https://api.github.com/repos/djblue/ddf/languages","stargazers_url":"https://api.github.com/repos/djblue/ddf/stargazers","contributors_url":"https://api.github.com/repos/djblue/ddf/contributors","subscribers_url":"https://api.github.com/repos/djblue/ddf/subscribers","subscription_url":"https://api.github.com/repos/djblue/ddf/subscription","commits_url":"https://api.github.com/repos/djblue/ddf/commits{/sha}","git_commits_url":"https://api.github.com/repos/djblue/ddf/git/commits{/sha}","comments_url":"https://api.github.com/repos/djblue/ddf/comments{/number}","issue_comment_url":"https://api.github.com/repos/djblue/ddf/issues/comments{/number}","contents_url":"https://api.github.com/repos/djblue/ddf/contents/{+path}","compare_url":"https://api.github.com/repos/djblue/ddf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/djblue/ddf/merges","archive_url":"https://api.github.com/repos/djblue/ddf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/djblue/ddf/downloads","issues_url":"https://api.github.com/repos/djblue/ddf/issues{/number}","pulls_url":"https://api.github.com/repos/djblue/ddf/pulls{/number}","milestones_url":"https://api.github.com/repos/djblue/ddf/milestones{/number}","notifications_url":"https://api.github.com/repos/djblue/ddf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/djblue/ddf/labels{/name}","releases_url":"https://api.github.com/repos/djblue/ddf/releases{/id}","deployments_url":"https://api.github.com/repos/djblue/ddf/deployments","created_at":"2015-06-15T13:54:03Z","updated_at":"2016-01-11T16:04:36Z","pushed_at":"2016-05-31T17:34:11Z","git_url":"git://github.com/djblue/ddf.git","ssh_url":"git@github.com:djblue/ddf.git","clone_url":"https://github.com/djblue/ddf.git","svn_url":"https://github.com/djblue/ddf","homepage":"","size":143681,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"codice:master","ref":"master","sha":"04d4293e187a61f65608245c7e361922244e38ea","user":{"login":"codice","id":2386734,"avatar_url":"https://avatars.githubusercontent.com/u/2386734?v=3","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"repo":{"id":15173563,"name":"ddf","full_name":"codice/ddf","owner":{"login":"codice","id":2386734,"avatar_url":"https://avatars.githubusercontent.com/u/2386734?v=3","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codice/ddf","description":"Distributed Data Framework - an open source, modular integration framework.","fork":false,"url":"https://api.github.com/repos/codice/ddf","forks_url":"https://api.github.com/repos/codice/ddf/forks","keys_url":"https://api.github.com/repos/codice/ddf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codice/ddf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codice/ddf/teams","hooks_url":"https://api.github.com/repos/codice/ddf/hooks","issue_events_url":"https://api.github.com/repos/codice/ddf/issues/events{/number}","events_url":"https://api.github.com/repos/codice/ddf/events","assignees_url":"https://api.github.com/repos/codice/ddf/assignees{/user}","branches_url":"https://api.github.com/repos/codice/ddf/branches{/branch}","tags_url":"https://api.github.com/repos/codice/ddf/tags","blobs_url":"https://api.github.com/repos/codice/ddf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codice/ddf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codice/ddf/git/refs{/sha}","trees_url":"https://api.github.com/repos/codice/ddf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codice/ddf/statuses/{sha}","languages_url":"https://api.github.com/repos/codice/ddf/languages","stargazers_url":"https://api.github.com/repos/codice/ddf/stargazers","contributors_url":"https://api.github.com/repos/codice/ddf/contributors","subscribers_url":"https://api.github.com/repos/codice/ddf/subscribers","subscription_url":"https://api.github.com/repos/codice/ddf/subscription","commits_url":"https://api.github.com/repos/codice/ddf/commits{/sha}","git_commits_url":"https://api.github.com/repos/codice/ddf/git/commits{/sha}","comments_url":"https://api.github.com/repos/codice/ddf/comments{/number}","issue_comment_url":"https://api.github.com/repos/codice/ddf/issues/comments{/number}","contents_url":"https://api.github.com/repos/codice/ddf/contents/{+path}","compare_url":"https://api.github.com/repos/codice/ddf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codice/ddf/merges","archive_url":"https://api.github.com/repos/codice/ddf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codice/ddf/downloads","issues_url":"https://api.github.com/repos/codice/ddf/issues{/number}","pulls_url":"https://api.github.com/repos/codice/ddf/pulls{/number}","milestones_url":"https://api.github.com/repos/codice/ddf/milestones{/number}","notifications_url":"https://api.github.com/repos/codice/ddf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codice/ddf/labels{/name}","releases_url":"https://api.github.com/repos/codice/ddf/releases{/id}","deployments_url":"https://api.github.com/repos/codice/ddf/deployments","created_at":"2013-12-13T20:38:28Z","updated_at":"2016-05-13T16:09:48Z","pushed_at":"2016-05-31T17:35:56Z","git_url":"git://github.com/codice/ddf.git","ssh_url":"git@github.com:codice/ddf.git","clone_url":"https://github.com/codice/ddf.git","svn_url":"https://github.com/codice/ddf","homepage":"http://ddf.codice.org","size":164359,"stargazers_count":37,"watchers_count":37,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":77,"mirror_url":null,"open_issues_count":32,"forks":77,"open_issues":32,"watchers":37,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codice/ddf/pulls/830"},"html":{"href":"https://github.com/codice/ddf/pull/830"},"issue":{"href":"https://api.github.com/repos/codice/ddf/issues/830"},"comments":{"href":"https://api.github.com/repos/codice/ddf/issues/830/comments"},"review_comments":{"href":"https://api.github.com/repos/codice/ddf/pulls/830/comments"},"review_comment":{"href":"https://api.github.com/repos/codice/ddf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codice/ddf/pulls/830/commits"},"statuses":{"href":"https://api.github.com/repos/codice/ddf/statuses/6a94ae3607cf6fced7b7aac8f3d759d09f17d16c"}}}}
{"actor":{"display_login":"stustison"}}