{"action":"created","comment":{"url":"https://api.github.com/repos/Wikia/pandora/pulls/comments/28162296","id":28162296,"diff_hunk":"@@ -0,0 +1,58 @@\n+package com.wikia.discussionservice.auth;\n+\n+import com.wikia.pandora.core.auth.Role;\n+import com.wikia.pandora.core.auth.ServiceRealm;\n+\n+import com.google.common.collect.Sets;\n+\n+import java.util.HashSet;\n+import java.util.Set;\n+\n+/**\n+ * Specific Authorization Realm for the Discussion Service\n+ */\n+public class DiscussionServiceRealm extends ServiceRealm {\n+\n+  @Override\n+  protected Set<String> getAdditionalPermissions(String userId,\n+                                                 Set<String> roles) {\n+    Set<String> permissions = new HashSet<>();","path":"service/discussion/src/main/java/com/wikia/discussionservice/auth/DiscussionServiceRealm.java","position":19,"original_position":19,"commit_id":"7ac103bfcffdf9100d1bf81bcf91ae4e3c8cb94e","original_commit_id":"7ac103bfcffdf9100d1bf81bcf91ae4e3c8cb94e","user":{"login":"armonr","id":1141431,"avatar_url":"https://avatars.githubusercontent.com/u/1141431?v=3","gravatar_id":"","url":"https://api.github.com/users/armonr","html_url":"https://github.com/armonr","followers_url":"https://api.github.com/users/armonr/followers","following_url":"https://api.github.com/users/armonr/following{/other_user}","gists_url":"https://api.github.com/users/armonr/gists{/gist_id}","starred_url":"https://api.github.com/users/armonr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/armonr/subscriptions","organizations_url":"https://api.github.com/users/armonr/orgs","repos_url":"https://api.github.com/users/armonr/repos","events_url":"https://api.github.com/users/armonr/events{/privacy}","received_events_url":"https://api.github.com/users/armonr/received_events","type":"User","site_admin":false},"body":"Minor: initialization can be moved to the default case.","created_at":"2015-04-10T17:10:19Z","updated_at":"2015-04-10T17:10:19Z","html_url":"https://github.com/Wikia/pandora/pull/152#discussion_r28162296","pull_request_url":"https://api.github.com/repos/Wikia/pandora/pulls/152","_links":{"self":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/comments/28162296"},"html":{"href":"https://github.com/Wikia/pandora/pull/152#discussion_r28162296"},"pull_request":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/152"}}},"pull_request":{"url":"https://api.github.com/repos/Wikia/pandora/pulls/152","id":32997105,"html_url":"https://github.com/Wikia/pandora/pull/152","diff_url":"https://github.com/Wikia/pandora/pull/152.diff","patch_url":"https://github.com/Wikia/pandora/pull/152.patch","issue_url":"https://api.github.com/repos/Wikia/pandora/issues/152","number":152,"state":"open","locked":false,"title":"Initial checkin of Shiro framework for Authn/Authz for Discussion Service","user":{"login":"jogura","id":907775,"avatar_url":"https://avatars.githubusercontent.com/u/907775?v=3","gravatar_id":"","url":"https://api.github.com/users/jogura","html_url":"https://github.com/jogura","followers_url":"https://api.github.com/users/jogura/followers","following_url":"https://api.github.com/users/jogura/following{/other_user}","gists_url":"https://api.github.com/users/jogura/gists{/gist_id}","starred_url":"https://api.github.com/users/jogura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jogura/subscriptions","organizations_url":"https://api.github.com/users/jogura/orgs","repos_url":"https://api.github.com/users/jogura/repos","events_url":"https://api.github.com/users/jogura/events{/privacy}","received_events_url":"https://api.github.com/users/jogura/received_events","type":"User","site_admin":false},"body":"This PR introduces the [Apache Shiro](http://shiro.apache.org) framework to handle Authn/Authz for the discussion service. The idea is to introduce an abstract `ServiceRealm` that will understand how to authenticate against Helios (using the Bearer tokens) and return the user's information as principals for the user. The principals will be used to retrieve the user's group information which can be used by the concrete class to fetch Service specific permissions.  \r\n**NOTE: Neither of those pieces have been implement as of yet but maybe coming shortly.** \r\n\r\nThe resources have been protected declaratively using the Shiro provided [JAX-RS annotations](http://shiro.apache.org/java-annotations-list.html).\r\n\r\n**NOTE: In the near future there maybe an Authentication Proxy that may replace this**\r\n\r\nRFCR @cmiller-wikia @drsnyder @pchojnacki @nmonterroso @jimmordino @armonr et al\r\n\r\nMore commit details:\r\n* Create an abstract `ServiceRealm` that *will* in the near future interact with Helios for AuthN and some yet-to-be-created service for user group\r\nsubclasses of this realm must implement the `getAdditionalPermissions()` to add Service specific permissions\r\n* Update the \"Resources\" with jax-rs annotations to declare the required Roles and Permissions access to the Resource's methods\r\n* Configure shiro to have a security filter that checks for Bearer token and creates the appropriate token for the `ServiceRealm` implementation\r\n* Refactored to use `ServiceExceptionMapper`\r\n* Add unit and integration tests","created_at":"2015-04-09T21:15:02Z","updated_at":"2015-04-10T17:10:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d907117bcd94ecc2d87a7919bf94c81da34cebda","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Wikia/pandora/pulls/152/commits","review_comments_url":"https://api.github.com/repos/Wikia/pandora/pulls/152/comments","review_comment_url":"https://api.github.com/repos/Wikia/pandora/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Wikia/pandora/issues/152/comments","statuses_url":"https://api.github.com/repos/Wikia/pandora/statuses/7ac103bfcffdf9100d1bf81bcf91ae4e3c8cb94e","head":{"label":"Wikia:DIS-16_authorization","ref":"DIS-16_authorization","sha":"7ac103bfcffdf9100d1bf81bcf91ae4e3c8cb94e","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":26663749,"name":"pandora","full_name":"Wikia/pandora","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/pandora","description":"API Service","fork":false,"url":"https://api.github.com/repos/Wikia/pandora","forks_url":"https://api.github.com/repos/Wikia/pandora/forks","keys_url":"https://api.github.com/repos/Wikia/pandora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/pandora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/pandora/teams","hooks_url":"https://api.github.com/repos/Wikia/pandora/hooks","issue_events_url":"https://api.github.com/repos/Wikia/pandora/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/pandora/events","assignees_url":"https://api.github.com/repos/Wikia/pandora/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/pandora/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/pandora/tags","blobs_url":"https://api.github.com/repos/Wikia/pandora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/pandora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/pandora/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/pandora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/pandora/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/pandora/languages","stargazers_url":"https://api.github.com/repos/Wikia/pandora/stargazers","contributors_url":"https://api.github.com/repos/Wikia/pandora/contributors","subscribers_url":"https://api.github.com/repos/Wikia/pandora/subscribers","subscription_url":"https://api.github.com/repos/Wikia/pandora/subscription","commits_url":"https://api.github.com/repos/Wikia/pandora/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/pandora/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/pandora/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/pandora/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/pandora/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/pandora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/pandora/merges","archive_url":"https://api.github.com/repos/Wikia/pandora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/pandora/downloads","issues_url":"https://api.github.com/repos/Wikia/pandora/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/pandora/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/pandora/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/pandora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/pandora/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/pandora/releases{/id}","created_at":"2014-11-15T00:29:06Z","updated_at":"2015-04-10T10:51:47Z","pushed_at":"2015-04-10T16:28:32Z","git_url":"git://github.com/Wikia/pandora.git","ssh_url":"git@github.com:Wikia/pandora.git","clone_url":"https://github.com/Wikia/pandora.git","svn_url":"https://github.com/Wikia/pandora","homepage":null,"size":7515,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":3,"default_branch":"master"}},"base":{"label":"Wikia:master","ref":"master","sha":"a695850b52f20f021c9d6a3e108f3a422af97f35","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":26663749,"name":"pandora","full_name":"Wikia/pandora","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/pandora","description":"API Service","fork":false,"url":"https://api.github.com/repos/Wikia/pandora","forks_url":"https://api.github.com/repos/Wikia/pandora/forks","keys_url":"https://api.github.com/repos/Wikia/pandora/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/pandora/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/pandora/teams","hooks_url":"https://api.github.com/repos/Wikia/pandora/hooks","issue_events_url":"https://api.github.com/repos/Wikia/pandora/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/pandora/events","assignees_url":"https://api.github.com/repos/Wikia/pandora/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/pandora/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/pandora/tags","blobs_url":"https://api.github.com/repos/Wikia/pandora/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/pandora/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/pandora/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/pandora/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/pandora/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/pandora/languages","stargazers_url":"https://api.github.com/repos/Wikia/pandora/stargazers","contributors_url":"https://api.github.com/repos/Wikia/pandora/contributors","subscribers_url":"https://api.github.com/repos/Wikia/pandora/subscribers","subscription_url":"https://api.github.com/repos/Wikia/pandora/subscription","commits_url":"https://api.github.com/repos/Wikia/pandora/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/pandora/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/pandora/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/pandora/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/pandora/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/pandora/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/pandora/merges","archive_url":"https://api.github.com/repos/Wikia/pandora/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/pandora/downloads","issues_url":"https://api.github.com/repos/Wikia/pandora/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/pandora/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/pandora/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/pandora/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/pandora/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/pandora/releases{/id}","created_at":"2014-11-15T00:29:06Z","updated_at":"2015-04-10T10:51:47Z","pushed_at":"2015-04-10T16:28:32Z","git_url":"git://github.com/Wikia/pandora.git","ssh_url":"git@github.com:Wikia/pandora.git","clone_url":"https://github.com/Wikia/pandora.git","svn_url":"https://github.com/Wikia/pandora","homepage":null,"size":7515,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/152"},"html":{"href":"https://github.com/Wikia/pandora/pull/152"},"issue":{"href":"https://api.github.com/repos/Wikia/pandora/issues/152"},"comments":{"href":"https://api.github.com/repos/Wikia/pandora/issues/152/comments"},"review_comments":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/152/comments"},"review_comment":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Wikia/pandora/pulls/152/commits"},"statuses":{"href":"https://api.github.com/repos/Wikia/pandora/statuses/7ac103bfcffdf9100d1bf81bcf91ae4e3c8cb94e"}}}}