{"action":"created","comment":{"url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/comments/198833404","pull_request_review_id":132833066,"id":198833404,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5ODgzMzQwNA==","diff_hunk":"@@ -0,0 +1,130 @@\n+/*\n+ * JBoss, Home of Professional Open Source.\n+ * Copyright 2018 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.authz;\n+\n+import java.util.LinkedHashMap;\n+import java.util.LinkedHashSet;\n+import java.util.Map;\n+import java.util.Set;\n+\n+/**\n+ * A simple mapping role mapper.\n+ *\n+ * Maps each role to a set of new roles using a String to Set<String> map.\n+ *\n+ * @author <a href=\"mailto:mmazanek@redhat.com\">Martin Mazanek</a>\n+ */\n+public class MappedRoleMapper implements RoleMapper {\n+\n+    private final Map<String, Set<String>> reverseRoleMap;\n+\n+    /**\n+     * Construct a new instance.\n+     * Called from WildFly core when using this as a custom component. You should not use this constructor and use {@link MappedRoleMapper.Builder} instead.\n+     *\n+     * @see MappedRoleMapper.Builder\n+     */\n+    public MappedRoleMapper() {\n+        this.reverseRoleMap = new LinkedHashMap<>();\n+    }\n+\n+\n+    private MappedRoleMapper(Map<String, Set<String>> roleMap) {\n+        this.reverseRoleMap = new LinkedHashMap<>();\n+\n+        Set<Map.Entry<String, Set<String>>> entrySet = roleMap.entrySet();\n+\n+        for (Map.Entry<String, Set<String>> entry : entrySet) {\n+\n+            for (String mappedRole : entry.getValue()) {\n+                Set<String> rolesToMappedRole = reverseRoleMap.get(mappedRole);\n+\n+                if (rolesToMappedRole == null) {\n+                    rolesToMappedRole = new LinkedHashSet<>();\n+                    reverseRoleMap.put(mappedRole, rolesToMappedRole);\n+                }\n+\n+                rolesToMappedRole.add(entry.getKey());\n+            }\n+        }\n+    }\n+\n+    /**\n+     * Custom component method.\n+     * Called from WildFly core. Used to include mapped role mapping functionality in older WildFly versions.\n+     *\n+     * @param configuration map of mapping rules where key is delegate role and value is whitespace separated list of new roles\n+     */\n+    public void initialize(final Map<String, String> configuration) {\n+        configuration.forEach( (key, value) -> {","path":"src/main/java/org/wildfly/security/authz/MappedRoleMapper.java","position":74,"original_position":74,"commit_id":"0477cf20f499b514c99c312ca83486c0fadcb87a","original_commit_id":"0477cf20f499b514c99c312ca83486c0fadcb87a","user":{"login":"hkalina","id":3178122,"node_id":"MDQ6VXNlcjMxNzgxMjI=","avatar_url":"https://avatars3.githubusercontent.com/u/3178122?v=4","gravatar_id":"","url":"https://api.github.com/users/hkalina","html_url":"https://github.com/hkalina","followers_url":"https://api.github.com/users/hkalina/followers","following_url":"https://api.github.com/users/hkalina/following{/other_user}","gists_url":"https://api.github.com/users/hkalina/gists{/gist_id}","starred_url":"https://api.github.com/users/hkalina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hkalina/subscriptions","organizations_url":"https://api.github.com/users/hkalina/orgs","repos_url":"https://api.github.com/users/hkalina/repos","events_url":"https://api.github.com/users/hkalina/events{/privacy}","received_events_url":"https://api.github.com/users/hkalina/received_events","type":"User","site_admin":false},"body":"I would say you have bug somewhere here, as `key` is not used....","created_at":"2018-06-28T13:09:41Z","updated_at":"2018-06-28T13:09:41Z","html_url":"https://github.com/wildfly-security/wildfly-elytron/pull/1146#discussion_r198833404","pull_request_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/1146","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/comments/198833404"},"html":{"href":"https://github.com/wildfly-security/wildfly-elytron/pull/1146#discussion_r198833404"},"pull_request":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/1146"}}},"pull_request":{"url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/1146","id":191700996,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxNzAwOTk2","html_url":"https://github.com/wildfly-security/wildfly-elytron/pull/1146","diff_url":"https://github.com/wildfly-security/wildfly-elytron/pull/1146.diff","patch_url":"https://github.com/wildfly-security/wildfly-elytron/pull/1146.patch","issue_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/issues/1146","number":1146,"state":"open","locked":false,"title":"[ELY-1591] Provide Elytron alternative to RoleMappingLoginModule","user":{"login":"nekdozjam","id":3662619,"node_id":"MDQ6VXNlcjM2NjI2MTk=","avatar_url":"https://avatars0.githubusercontent.com/u/3662619?v=4","gravatar_id":"","url":"https://api.github.com/users/nekdozjam","html_url":"https://github.com/nekdozjam","followers_url":"https://api.github.com/users/nekdozjam/followers","following_url":"https://api.github.com/users/nekdozjam/following{/other_user}","gists_url":"https://api.github.com/users/nekdozjam/gists{/gist_id}","starred_url":"https://api.github.com/users/nekdozjam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nekdozjam/subscriptions","organizations_url":"https://api.github.com/users/nekdozjam/orgs","repos_url":"https://api.github.com/users/nekdozjam/repos","events_url":"https://api.github.com/users/nekdozjam/events{/privacy}","received_events_url":"https://api.github.com/users/nekdozjam/received_events","type":"User","site_admin":false},"body":"https://issues.jboss.org/browse/ELY-1591","created_at":"2018-05-31T09:51:18Z","updated_at":"2018-06-28T13:09:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6ccf3fc4492488bcbed5907f6f8447c064d180a8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":835024646,"node_id":"MDU6TGFiZWw4MzUwMjQ2NDY=","url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/labels/Feature%20Request","name":"Feature Request","color":"85a5db","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/1146/commits","review_comments_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/1146/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/1146/comments","statuses_url":"https://api.github.com/repos/wildfly-security/wildfly-elytron/statuses/0477cf20f499b514c99c312ca83486c0fadcb87a","head":{"label":"nekdozjam:ELY-1591","ref":"ELY-1591","sha":"0477cf20f499b514c99c312ca83486c0fadcb87a","user":{"login":"nekdozjam","id":3662619,"node_id":"MDQ6VXNlcjM2NjI2MTk=","avatar_url":"https://avatars0.githubusercontent.com/u/3662619?v=4","gravatar_id":"","url":"https://api.github.com/users/nekdozjam","html_url":"https://github.com/nekdozjam","followers_url":"https://api.github.com/users/nekdozjam/followers","following_url":"https://api.github.com/users/nekdozjam/following{/other_user}","gists_url":"https://api.github.com/users/nekdozjam/gists{/gist_id}","starred_url":"https://api.github.com/users/nekdozjam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nekdozjam/subscriptions","organizations_url":"https://api.github.com/users/nekdozjam/orgs","repos_url":"https://api.github.com/users/nekdozjam/repos","events_url":"https://api.github.com/users/nekdozjam/events{/privacy}","received_events_url":"https://api.github.com/users/nekdozjam/received_events","type":"User","site_admin":false},"repo":{"id":103115498,"node_id":"MDEwOlJlcG9zaXRvcnkxMDMxMTU0OTg=","name":"wildfly-elytron","full_name":"nekdozjam/wildfly-elytron","owner":{"login":"nekdozjam","id":3662619,"node_id":"MDQ6VXNlcjM2NjI2MTk=","avatar_url":"https://avatars0.githubusercontent.com/u/3662619?v=4","gravatar_id":"","url":"https://api.github.com/users/nekdozjam","html_url":"https://github.com/nekdozjam","followers_url":"https://api.github.com/users/nekdozjam/followers","following_url":"https://api.github.com/users/nekdozjam/following{/other_user}","gists_url":"https://api.github.com/users/nekdozjam/gists{/gist_id}","starred_url":"https://api.github.com/users/nekdozjam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nekdozjam/subscriptions","organizations_url":"https://api.github.com/users/nekdozjam/orgs","repos_url":"https://api.github.com/users/nekdozjam/repos","events_url":"https://api.github.com/users/nekdozjam/events{/privacy}","received_events_url":"https://api.github.com/users/nekdozjam/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nekdozjam/wildfly-elytron","description":"WildFly Elytron: Security, Authentication, and Authorization SPIs for the WildFly project","fork":true,"url":"https://api.github.com/repos/nekdozjam/wildfly-elytron","forks_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/forks","keys_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/teams","hooks_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/hooks","issue_events_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/issues/events{/number}","events_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/events","assignees_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/assignees{/user}","branches_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/branches{/branch}","tags_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/tags","blobs_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/git/refs{/sha}","trees_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/statuses/{sha}","languages_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/languages","stargazers_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/stargazers","contributors_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/contributors","subscribers_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/subscribers","subscription_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/subscription","commits_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/commits{/sha}","git_commits_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/git/commits{/sha}","comments_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/comments{/number}","issue_comment_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/issues/comments{/number}","contents_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/contents/{+path}","compare_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/merges","archive_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/downloads","issues_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/issues{/number}","pulls_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/pulls{/number}","milestones_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/milestones{/number}","notifications_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/labels{/name}","releases_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/releases{/id}","deployments_url":"https://api.github.com/repos/nekdozjam/wildfly-elytron/deployments","created_at":"2017-09-11T09:18:04Z","updated_at":"2018-05-21T15:18:54Z","pushed_at":"2018-06-28T12:40:13Z","git_url":"git://github.com/nekdozjam/wildfly-elytron.git","ssh_url":"git@github.com:nekdozjam/wildfly-elytron.git","clone_url":"https://github.com/nekdozjam/wildfly-elytron.git","svn_url":"https://github.com/nekdozjam/wildfly-elytron","homepage":"http://wildfly.org/","size":30787,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"wildfly-security:master","ref":"master","sha":"38e1e01972414ad70710a4922e259de4eec9ddfd","user":{"login":"wildfly-security","id":7501379,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc1MDEzNzk=","avatar_url":"https://avatars2.githubusercontent.com/u/7501379?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY2MDk3Nw==","name":"wildfly-elytron","full_name":"wildfly-security/wildfly-elytron","owner":{"login":"wildfly-security","id":7501379,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc1MDEzNzk=","avatar_url":"https://avatars2.githubusercontent.com/u/7501379?v=4","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":"2018-06-26T13:44:37Z","pushed_at":"2018-06-28T12:40:15Z","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":60563,"stargazers_count":27,"watchers_count":27,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":60,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":60,"open_issues":12,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/1146"},"html":{"href":"https://github.com/wildfly-security/wildfly-elytron/pull/1146"},"issue":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/issues/1146"},"comments":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/issues/1146/comments"},"review_comments":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/pulls/1146/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/1146/commits"},"statuses":{"href":"https://api.github.com/repos/wildfly-security/wildfly-elytron/statuses/0477cf20f499b514c99c312ca83486c0fadcb87a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"hkalina"}}