{"action":"created","comment":{"url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/comments/87035540","pull_request_review_id":7664078,"id":87035540,"diff_hunk":"@@ -0,0 +1,167 @@\n+/*\n+ * JBoss, Home of Professional Open Source.\n+ * Copyright 2016 Red Hat, Inc., and individual contributors\n+ * as indicated by the @author tags.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.wildfly.security.auth.server;\n+\n+import java.security.Principal;\n+import java.security.acl.Group;\n+import java.util.Collections;\n+import java.util.Enumeration;\n+import java.util.HashSet;\n+import java.util.Set;\n+\n+import javax.security.auth.Subject;\n+\n+import org.wildfly.common.Assert;\n+import org.wildfly.security.auth.principal.NamePrincipal;\n+import org.wildfly.security.authz.Attributes;\n+import org.wildfly.security.authz.AuthorizationIdentity;\n+import org.wildfly.security.authz.MapAttributes;\n+import org.wildfly.security.credential.PublicKeyCredential;\n+\n+/**\n+ * Utilities for dealing with {@link Subject}.\n+ *\n+ * @author <a href=\"mailto:sguilhen@redhat.com\">Stefan Guilhen</a>\n+ */\n+public final class SubjectUtil {\n+\n+    /**\n+     * Converts the supplied {@link SecurityIdentity} into a {@link Subject}.\n+     *\n+     * @param securityIdentity the {@link SecurityIdentity} to be converted.\n+     * @return the constructed {@link Subject} instance.\n+     */\n+    public static Subject fromSecurityIdentity(final SecurityIdentity securityIdentity) {\n+        Assert.checkNotNullParam(\"securityIdentity\", securityIdentity);\n+        Subject subject = new Subject();\n+        subject.getPrincipals().add(securityIdentity.getPrincipal());\n+\n+        // add the 'Roles' group to the subject containing the identity's mapped roles.\n+        Group rolesGroup = new SimpleGroup(\"Roles\");","path":"src/main/java/org/wildfly/security/auth/server/SubjectUtil.java","position":55,"original_position":55,"commit_id":"4643c21833af15d8a4e8959579ea3027534b43af","original_commit_id":"4643c21833af15d8a4e8959579ea3027534b43af","user":{"login":"dmlloyd","id":124581,"avatar_url":"https://avatars.githubusercontent.com/u/124581?v=3","gravatar_id":"","url":"https://api.github.com/users/dmlloyd","html_url":"https://github.com/dmlloyd","followers_url":"https://api.github.com/users/dmlloyd/followers","following_url":"https://api.github.com/users/dmlloyd/following{/other_user}","gists_url":"https://api.github.com/users/dmlloyd/gists{/gist_id}","starred_url":"https://api.github.com/users/dmlloyd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmlloyd/subscriptions","organizations_url":"https://api.github.com/users/dmlloyd/orgs","repos_url":"https://api.github.com/users/dmlloyd/repos","events_url":"https://api.github.com/users/dmlloyd/events{/privacy}","received_events_url":"https://api.github.com/users/dmlloyd/received_events","type":"User","site_admin":false},"body":"This is super-legacy.  What uses the old Group API?","created_at":"2016-11-08T17:04:54Z","updated_at":"2016-11-08T17:04:54Z","html_url":"https://github.com/wildfly-security/wildfly-elytron/pull/542#discussion_r87035540","pull_request_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/542","_links":{"self":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/comments/87035540"},"html":{"href":"https://github.com/wildfly-security/wildfly-elytron/pull/542#discussion_r87035540"},"pull_request":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/542"}}},"pull_request":{"url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/542","id":92817485,"html_url":"https://github.com/wildfly-security/wildfly-elytron/pull/542","diff_url":"https://github.com/wildfly-security/wildfly-elytron/pull/542.diff","patch_url":"https://github.com/wildfly-security/wildfly-elytron/pull/542.patch","issue_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/issues/542","number":542,"state":"open","locked":false,"title":"[ELY-729] Add an utility class to perform Subject/SecurityIdentity co…","user":{"login":"sguilhen","id":355702,"avatar_url":"https://avatars.githubusercontent.com/u/355702?v=3","gravatar_id":"","url":"https://api.github.com/users/sguilhen","html_url":"https://github.com/sguilhen","followers_url":"https://api.github.com/users/sguilhen/followers","following_url":"https://api.github.com/users/sguilhen/following{/other_user}","gists_url":"https://api.github.com/users/sguilhen/gists{/gist_id}","starred_url":"https://api.github.com/users/sguilhen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguilhen/subscriptions","organizations_url":"https://api.github.com/users/sguilhen/orgs","repos_url":"https://api.github.com/users/sguilhen/repos","events_url":"https://api.github.com/users/sguilhen/events{/privacy}","received_events_url":"https://api.github.com/users/sguilhen/received_events","type":"User","site_admin":false},"body":"…nversions","created_at":"2016-11-08T16:58:16Z","updated_at":"2016-11-08T17:04:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eaa5b0060a79b892cf673f0b1cde50d3febea4b8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/542/commits","review_comments_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/542/comments","review_comment_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/issues/542/comments","statuses_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/statuses/4643c21833af15d8a4e8959579ea3027534b43af","head":{"label":"sguilhen:master","ref":"master","sha":"4643c21833af15d8a4e8959579ea3027534b43af","user":{"login":"sguilhen","id":355702,"avatar_url":"https://avatars.githubusercontent.com/u/355702?v=3","gravatar_id":"","url":"https://api.github.com/users/sguilhen","html_url":"https://github.com/sguilhen","followers_url":"https://api.github.com/users/sguilhen/followers","following_url":"https://api.github.com/users/sguilhen/following{/other_user}","gists_url":"https://api.github.com/users/sguilhen/gists{/gist_id}","starred_url":"https://api.github.com/users/sguilhen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguilhen/subscriptions","organizations_url":"https://api.github.com/users/sguilhen/orgs","repos_url":"https://api.github.com/users/sguilhen/repos","events_url":"https://api.github.com/users/sguilhen/events{/privacy}","received_events_url":"https://api.github.com/users/sguilhen/received_events","type":"User","site_admin":false},"repo":{"id":19499629,"name":"wildfly-elytron","full_name":"sguilhen/wildfly-elytron","owner":{"login":"sguilhen","id":355702,"avatar_url":"https://avatars.githubusercontent.com/u/355702?v=3","gravatar_id":"","url":"https://api.github.com/users/sguilhen","html_url":"https://github.com/sguilhen","followers_url":"https://api.github.com/users/sguilhen/followers","following_url":"https://api.github.com/users/sguilhen/following{/other_user}","gists_url":"https://api.github.com/users/sguilhen/gists{/gist_id}","starred_url":"https://api.github.com/users/sguilhen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguilhen/subscriptions","organizations_url":"https://api.github.com/users/sguilhen/orgs","repos_url":"https://api.github.com/users/sguilhen/repos","events_url":"https://api.github.com/users/sguilhen/events{/privacy}","received_events_url":"https://api.github.com/users/sguilhen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sguilhen/wildfly-elytron","description":"The WildFly Remoting-based authentication protocol implementation.","fork":true,"url":"https://api.github.com/repos/sguilhen/wildfly-elytron","forks_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/forks","keys_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/teams","hooks_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/hooks","issue_events_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/issues/events{/number}","events_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/events","assignees_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/assignees{/user}","branches_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/branches{/branch}","tags_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/tags","blobs_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/git/refs{/sha}","trees_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/statuses/{sha}","languages_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/languages","stargazers_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/stargazers","contributors_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/contributors","subscribers_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/subscribers","subscription_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/subscription","commits_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/commits{/sha}","git_commits_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/git/commits{/sha}","comments_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/comments{/number}","issue_comment_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/issues/comments{/number}","contents_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/contents/{+path}","compare_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/merges","archive_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/downloads","issues_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/issues{/number}","pulls_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/pulls{/number}","milestones_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/milestones{/number}","notifications_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/labels{/name}","releases_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/releases{/id}","deployments_url":"https://api.github.com/repos/sguilhen/wildfly-elytron/deployments","created_at":"2014-05-06T15:28:54Z","updated_at":"2016-11-08T16:57:41Z","pushed_at":"2016-11-08T16:56:42Z","git_url":"git://github.com/sguilhen/wildfly-elytron.git","ssh_url":"git@github.com:sguilhen/wildfly-elytron.git","clone_url":"https://github.com/sguilhen/wildfly-elytron.git","svn_url":"https://github.com/sguilhen/wildfly-elytron","homepage":null,"size":2717,"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":"wildfly-security:master","ref":"master","sha":"4ce3aea60b9f5c2a6fb483c6340dc5abbb5be79e","user":{"login":"wildfly-security","id":7501379,"avatar_url":"https://avatars.githubusercontent.com/u/7501379?v=3","gravatar_id":"","url":"https://api.github.com/users/wildfly-security","html_url":"https://github.com/wildfly-security","followers_url":"https://api.github.com/users/wildfly-security/followers","following_url":"https://api.github.com/users/wildfly-security/following{/other_user}","gists_url":"https://api.github.com/users/wildfly-security/gists{/gist_id}","starred_url":"https://api.github.com/users/wildfly-security/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildfly-security/subscriptions","organizations_url":"https://api.github.com/users/wildfly-security/orgs","repos_url":"https://api.github.com/users/wildfly-security/repos","events_url":"https://api.github.com/users/wildfly-security/events{/privacy}","received_events_url":"https://api.github.com/users/wildfly-security/received_events","type":"Organization","site_admin":false},"repo":{"id":13660977,"name":"wildfly-elytron","full_name":"wildfly-security/wildfly-elytron","owner":{"login":"wildfly-security","id":7501379,"avatar_url":"https://avatars.githubusercontent.com/u/7501379?v=3","gravatar_id":"","url":"https://api.github.com/users/wildfly-security","html_url":"https://github.com/wildfly-security","followers_url":"https://api.github.com/users/wildfly-security/followers","following_url":"https://api.github.com/users/wildfly-security/following{/other_user}","gists_url":"https://api.github.com/users/wildfly-security/gists{/gist_id}","starred_url":"https://api.github.com/users/wildfly-security/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wildfly-security/subscriptions","organizations_url":"https://api.github.com/users/wildfly-security/orgs","repos_url":"https://api.github.com/users/wildfly-security/repos","events_url":"https://api.github.com/users/wildfly-security/events{/privacy}","received_events_url":"https://api.github.com/users/wildfly-security/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wildfly-security/wildfly-elytron","description":"WildFly Elytron: Security, Authentication, and Authorization SPIs for the WildFly project","fork":false,"url":"https://api.github.com/repos/wildfly-security/wildfly-elytron","forks_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/forks","keys_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/teams","hooks_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/hooks","issue_events_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/issues/events{/number}","events_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/events","assignees_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/assignees{/user}","branches_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/branches{/branch}","tags_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/tags","blobs_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/git/refs{/sha}","trees_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/statuses/{sha}","languages_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/languages","stargazers_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/stargazers","contributors_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/contributors","subscribers_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/subscribers","subscription_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/subscription","commits_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/commits{/sha}","git_commits_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/git/commits{/sha}","comments_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/comments{/number}","issue_comment_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/issues/comments{/number}","contents_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/contents/{+path}","compare_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/merges","archive_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/downloads","issues_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/issues{/number}","pulls_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls{/number}","milestones_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/milestones{/number}","notifications_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/labels{/name}","releases_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/releases{/id}","deployments_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/deployments","created_at":"2013-10-17T20:57:07Z","updated_at":"2016-11-04T19:22:21Z","pushed_at":"2016-11-08T16:58:16Z","git_url":"git://github.com/wildfly-security/wildfly-elytron.git","ssh_url":"git@github.com:wildfly-security/wildfly-elytron.git","clone_url":"https://github.com/wildfly-security/wildfly-elytron.git","svn_url":"https://github.com/wildfly-security/wildfly-elytron","homepage":"http://wildfly.org/","size":25843,"stargazers_count":18,"watchers_count":18,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":32,"mirror_url":null,"open_issues_count":12,"forks":32,"open_issues":12,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/542"},"html":{"href":"https://github.com/wildfly-security/wildfly-elytron/pull/542"},"issue":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/issues/542"},"comments":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/issues/542/comments"},"review_comments":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/542/comments"},"review_comment":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/542/commits"},"statuses":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/statuses/4643c21833af15d8a4e8959579ea3027534b43af"}}}}
{"actor":{"display_login":"dmlloyd"}}