{"action":"created","comment":{"url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/comments/238699029","pull_request_review_id":181302801,"id":238699029,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODY5OTAyOQ==","diff_hunk":"@@ -0,0 +1,55 @@\n+package com.deezer.web.security;\n+\n+import com.deezer.entity.User;\n+import com.deezer.service.security.SecurityService;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.stereotype.Service;\n+import org.springframework.web.context.support.SpringBeanAutowiringSupport;\n+\n+import javax.servlet.*;\n+import javax.servlet.http.HttpServletRequest;\n+import java.io.IOException;\n+import java.util.Optional;\n+\n+@Service\n+public class AuthFilter implements Filter {\n+    private static final String USER_TOKEN = \"User-Token\";\n+    private final Logger log = LoggerFactory.getLogger(getClass());\n+    @Autowired\n+    private SecurityService securityService;\n+\n+\n+    @Override\n+    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {\n+        HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;\n+        String token = httpServletRequest.getHeader(USER_TOKEN);\n+        if (token != null) {\n+            Optional<User> userByToken = securityService.getUserByToken(token);\n+            if (userByToken.isPresent()) {\n+                User user = userByToken.get();\n+                log.info(\"User {} is added to principal\", user);\n+                filterChain.doFilter(new UserRequestWrapper(httpServletRequest, user), servletResponse);\n+            } else {\n+                log.info(\"User token {} is invalid\", token);\n+                filterChain.doFilter(new UserRequestWrapper(httpServletRequest, null), servletResponse);\n+            }\n+        } else {\n+            log.info(\"User is not logged in\");\n+            filterChain.doFilter(servletRequest, servletResponse);\n+        }\n+    }\n+\n+    @Override\n+    public void destroy() {","path":"src/main/java/com/deezer/web/security/AuthFilter.java","position":45,"original_position":45,"commit_id":"0655f6239173abde6803dbb1dd509f4dd8af6bb4","original_commit_id":"0655f6239173abde6803dbb1dd509f4dd8af6bb4","user":{"login":"sonarcloud[bot]","id":39514782,"node_id":"MDM6Qm90Mzk1MTQ3ODI=","avatar_url":"https://avatars2.githubusercontent.com/in/12526?v=4","gravatar_id":"","url":"https://api.github.com/users/sonarcloud%5Bbot%5D","html_url":"https://github.com/apps/sonarcloud","followers_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/followers","following_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/repos","events_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"![Code Smell](https://sonarsource.github.io/sonar-github/code_smell.png 'Code Smell') Code Smell: Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation. ([squid:S1186](https://sonarcloud.io/organizations/dmitriyshalimov-github/rules#rule_key=squid%3AS1186))\n\n[See it in SonarCloud](https://sonarcloud.io/project/issues?id=com.deezer&pullRequest=23&issues=AWd5t_7nCh2zBQVNEzeW&open=AWd5t_7nCh2zBQVNEzeW)\n\n[ISSUE_KEY]: AWd5t_7nCh2zBQVNEzeW","created_at":"2018-12-04T15:04:18Z","updated_at":"2018-12-04T15:04:18Z","html_url":"https://github.com/DmitriyShalimov/Deezer/pull/23#discussion_r238699029","pull_request_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/23","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/comments/238699029"},"html":{"href":"https://github.com/DmitriyShalimov/Deezer/pull/23#discussion_r238699029"},"pull_request":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/23","id":235838011,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1ODM4MDEx","html_url":"https://github.com/DmitriyShalimov/Deezer/pull/23","diff_url":"https://github.com/DmitriyShalimov/Deezer/pull/23.diff","patch_url":"https://github.com/DmitriyShalimov/Deezer/pull/23.patch","issue_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/23","number":23,"state":"open","locked":false,"title":"React login registration","user":{"login":"sunnyno","id":11801738,"node_id":"MDQ6VXNlcjExODAxNzM4","avatar_url":"https://avatars0.githubusercontent.com/u/11801738?v=4","gravatar_id":"","url":"https://api.github.com/users/sunnyno","html_url":"https://github.com/sunnyno","followers_url":"https://api.github.com/users/sunnyno/followers","following_url":"https://api.github.com/users/sunnyno/following{/other_user}","gists_url":"https://api.github.com/users/sunnyno/gists{/gist_id}","starred_url":"https://api.github.com/users/sunnyno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunnyno/subscriptions","organizations_url":"https://api.github.com/users/sunnyno/orgs","repos_url":"https://api.github.com/users/sunnyno/repos","events_url":"https://api.github.com/users/sunnyno/events{/privacy}","received_events_url":"https://api.github.com/users/sunnyno/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-04T14:53:51Z","updated_at":"2018-12-04T15:04:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a71d54db6d953e97a36e45d9e8de08d3d966c2a0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/23/commits","review_comments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/23/comments","review_comment_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/23/comments","statuses_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/statuses/0655f6239173abde6803dbb1dd509f4dd8af6bb4","head":{"label":"DmitriyShalimov:react-login-registration","ref":"react-login-registration","sha":"0655f6239173abde6803dbb1dd509f4dd8af6bb4","user":{"login":"DmitriyShalimov","id":13985369,"node_id":"MDQ6VXNlcjEzOTg1MzY5","avatar_url":"https://avatars1.githubusercontent.com/u/13985369?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitriyShalimov","html_url":"https://github.com/DmitriyShalimov","followers_url":"https://api.github.com/users/DmitriyShalimov/followers","following_url":"https://api.github.com/users/DmitriyShalimov/following{/other_user}","gists_url":"https://api.github.com/users/DmitriyShalimov/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitriyShalimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitriyShalimov/subscriptions","organizations_url":"https://api.github.com/users/DmitriyShalimov/orgs","repos_url":"https://api.github.com/users/DmitriyShalimov/repos","events_url":"https://api.github.com/users/DmitriyShalimov/events{/privacy}","received_events_url":"https://api.github.com/users/DmitriyShalimov/received_events","type":"User","site_admin":false},"repo":{"id":148375558,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgzNzU1NTg=","name":"Deezer","full_name":"DmitriyShalimov/Deezer","private":false,"owner":{"login":"DmitriyShalimov","id":13985369,"node_id":"MDQ6VXNlcjEzOTg1MzY5","avatar_url":"https://avatars1.githubusercontent.com/u/13985369?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitriyShalimov","html_url":"https://github.com/DmitriyShalimov","followers_url":"https://api.github.com/users/DmitriyShalimov/followers","following_url":"https://api.github.com/users/DmitriyShalimov/following{/other_user}","gists_url":"https://api.github.com/users/DmitriyShalimov/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitriyShalimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitriyShalimov/subscriptions","organizations_url":"https://api.github.com/users/DmitriyShalimov/orgs","repos_url":"https://api.github.com/users/DmitriyShalimov/repos","events_url":"https://api.github.com/users/DmitriyShalimov/events{/privacy}","received_events_url":"https://api.github.com/users/DmitriyShalimov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/DmitriyShalimov/Deezer","description":null,"fork":false,"url":"https://api.github.com/repos/DmitriyShalimov/Deezer","forks_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/forks","keys_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/teams","hooks_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/hooks","issue_events_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/events{/number}","events_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/events","assignees_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/assignees{/user}","branches_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/branches{/branch}","tags_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/tags","blobs_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/refs{/sha}","trees_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/statuses/{sha}","languages_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/languages","stargazers_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/stargazers","contributors_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/contributors","subscribers_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/subscribers","subscription_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/subscription","commits_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/commits{/sha}","git_commits_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/commits{/sha}","comments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/comments{/number}","issue_comment_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/comments{/number}","contents_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/contents/{+path}","compare_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/merges","archive_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/downloads","issues_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues{/number}","pulls_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls{/number}","milestones_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/milestones{/number}","notifications_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/labels{/name}","releases_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/releases{/id}","deployments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/deployments","created_at":"2018-09-11T20:22:44Z","updated_at":"2018-11-29T11:14:48Z","pushed_at":"2018-12-04T15:02:13Z","git_url":"git://github.com/DmitriyShalimov/Deezer.git","ssh_url":"git@github.com:DmitriyShalimov/Deezer.git","clone_url":"https://github.com/DmitriyShalimov/Deezer.git","svn_url":"https://github.com/DmitriyShalimov/Deezer","homepage":null,"size":1134,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"DmitriyShalimov:master","ref":"master","sha":"0e0b20e9cc3161bd63d1a7611da330684caedd3c","user":{"login":"DmitriyShalimov","id":13985369,"node_id":"MDQ6VXNlcjEzOTg1MzY5","avatar_url":"https://avatars1.githubusercontent.com/u/13985369?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitriyShalimov","html_url":"https://github.com/DmitriyShalimov","followers_url":"https://api.github.com/users/DmitriyShalimov/followers","following_url":"https://api.github.com/users/DmitriyShalimov/following{/other_user}","gists_url":"https://api.github.com/users/DmitriyShalimov/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitriyShalimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitriyShalimov/subscriptions","organizations_url":"https://api.github.com/users/DmitriyShalimov/orgs","repos_url":"https://api.github.com/users/DmitriyShalimov/repos","events_url":"https://api.github.com/users/DmitriyShalimov/events{/privacy}","received_events_url":"https://api.github.com/users/DmitriyShalimov/received_events","type":"User","site_admin":false},"repo":{"id":148375558,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgzNzU1NTg=","name":"Deezer","full_name":"DmitriyShalimov/Deezer","private":false,"owner":{"login":"DmitriyShalimov","id":13985369,"node_id":"MDQ6VXNlcjEzOTg1MzY5","avatar_url":"https://avatars1.githubusercontent.com/u/13985369?v=4","gravatar_id":"","url":"https://api.github.com/users/DmitriyShalimov","html_url":"https://github.com/DmitriyShalimov","followers_url":"https://api.github.com/users/DmitriyShalimov/followers","following_url":"https://api.github.com/users/DmitriyShalimov/following{/other_user}","gists_url":"https://api.github.com/users/DmitriyShalimov/gists{/gist_id}","starred_url":"https://api.github.com/users/DmitriyShalimov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DmitriyShalimov/subscriptions","organizations_url":"https://api.github.com/users/DmitriyShalimov/orgs","repos_url":"https://api.github.com/users/DmitriyShalimov/repos","events_url":"https://api.github.com/users/DmitriyShalimov/events{/privacy}","received_events_url":"https://api.github.com/users/DmitriyShalimov/received_events","type":"User","site_admin":false},"html_url":"https://github.com/DmitriyShalimov/Deezer","description":null,"fork":false,"url":"https://api.github.com/repos/DmitriyShalimov/Deezer","forks_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/forks","keys_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/teams","hooks_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/hooks","issue_events_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/events{/number}","events_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/events","assignees_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/assignees{/user}","branches_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/branches{/branch}","tags_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/tags","blobs_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/refs{/sha}","trees_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/statuses/{sha}","languages_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/languages","stargazers_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/stargazers","contributors_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/contributors","subscribers_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/subscribers","subscription_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/subscription","commits_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/commits{/sha}","git_commits_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/git/commits{/sha}","comments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/comments{/number}","issue_comment_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/comments{/number}","contents_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/contents/{+path}","compare_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/merges","archive_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/downloads","issues_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues{/number}","pulls_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls{/number}","milestones_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/milestones{/number}","notifications_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/labels{/name}","releases_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/releases{/id}","deployments_url":"https://api.github.com/repos/DmitriyShalimov/Deezer/deployments","created_at":"2018-09-11T20:22:44Z","updated_at":"2018-11-29T11:14:48Z","pushed_at":"2018-12-04T15:02:13Z","git_url":"git://github.com/DmitriyShalimov/Deezer.git","ssh_url":"git@github.com:DmitriyShalimov/Deezer.git","clone_url":"https://github.com/DmitriyShalimov/Deezer.git","svn_url":"https://github.com/DmitriyShalimov/Deezer","homepage":null,"size":1134,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/23"},"html":{"href":"https://github.com/DmitriyShalimov/Deezer/pull/23"},"issue":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/23"},"comments":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/DmitriyShalimov/Deezer/statuses/0655f6239173abde6803dbb1dd509f4dd8af6bb4"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"sonarcloud"}}