{"action":"created","comment":{"url":"https://api.github.com/repos/shine1982/oscra-api/pulls/comments/81627175","pull_request_review_id":2593783,"id":81627175,"diff_hunk":"@@ -0,0 +1,47 @@\n+package fr.ospiea.oscra.employee.controller;\n+\n+import fr.ospiea.oscra.employee.object.Employee;\n+import fr.ospiea.oscra.employee.service.EmployeeService;\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.web.bind.annotation.*;\n+\n+import java.util.List;\n+\n+/**\n+ * Created by fqin on 18/09/2016.\n+ */\n+@RestController\n+@RequestMapping(\"/api/employees\")","path":"src/main/java/fr/ospiea/oscra/employee/controller/EmployeeController.java","position":null,"original_position":14,"commit_id":"54f8517856463151576683a5d79f9d5e643313ab","original_commit_id":"81c2059ac211027c6a6407789ef8c49c083d1a34","user":{"login":"shine1982","id":1681270,"avatar_url":"https://avatars.githubusercontent.com/u/1681270?v=3","gravatar_id":"","url":"https://api.github.com/users/shine1982","html_url":"https://github.com/shine1982","followers_url":"https://api.github.com/users/shine1982/followers","following_url":"https://api.github.com/users/shine1982/following{/other_user}","gists_url":"https://api.github.com/users/shine1982/gists{/gist_id}","starred_url":"https://api.github.com/users/shine1982/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shine1982/subscriptions","organizations_url":"https://api.github.com/users/shine1982/orgs","repos_url":"https://api.github.com/users/shine1982/repos","events_url":"https://api.github.com/users/shine1982/events{/privacy}","received_events_url":"https://api.github.com/users/shine1982/received_events","type":"User","site_admin":false},"body":"not really. You should search the solution that reply to every controller instead of copying '/api' everywhere.\r\nThe solution: add \r\n# server.contextPath=/api \r\n\r\nin the application.properties\r\n","created_at":"2016-10-03T19:58:41Z","updated_at":"2016-10-03T19:58:42Z","html_url":"https://github.com/shine1982/oscra-api/pull/1#discussion_r81627175","pull_request_url":"https://api.github.com/repos/shine1982/oscra-api/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/shine1982/oscra-api/pulls/comments/81627175"},"html":{"href":"https://github.com/shine1982/oscra-api/pull/1#discussion_r81627175"},"pull_request":{"href":"https://api.github.com/repos/shine1982/oscra-api/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/shine1982/oscra-api/pulls/1","id":87308930,"html_url":"https://github.com/shine1982/oscra-api/pull/1","diff_url":"https://github.com/shine1982/oscra-api/pull/1.diff","patch_url":"https://github.com/shine1982/oscra-api/pull/1.patch","issue_url":"https://api.github.com/repos/shine1982/oscra-api/issues/1","number":1,"state":"open","locked":false,"title":"Rest security","user":{"login":"nicolas2lee","id":8910318,"avatar_url":"https://avatars.githubusercontent.com/u/8910318?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolas2lee","html_url":"https://github.com/nicolas2lee","followers_url":"https://api.github.com/users/nicolas2lee/followers","following_url":"https://api.github.com/users/nicolas2lee/following{/other_user}","gists_url":"https://api.github.com/users/nicolas2lee/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolas2lee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolas2lee/subscriptions","organizations_url":"https://api.github.com/users/nicolas2lee/orgs","repos_url":"https://api.github.com/users/nicolas2lee/repos","events_url":"https://api.github.com/users/nicolas2lee/events{/privacy}","received_events_url":"https://api.github.com/users/nicolas2lee/received_events","type":"User","site_admin":false},"body":"Add spring security @shine1982 \r\n\r\nExample of use \r\n\r\n- Login\r\n\r\n \r\nPOST http://localhost:8080/api/login?username=user&password=123456\r\n\r\nThe password would be encrypted by using bcrypt.\r\nFor example(123456 =>$2a$10$EblZqNptyYvcLm/VwDCVAuBjzZOI7khzdyGPBr08PpIi0na624b8.)\r\nThe hash is generated randomly, in other words, each time according to the same password, the hash would be different.\r\n\r\n- visit service \r\nGET http://localhost:8080/api/employees/all\r\n\r\n-  logout\r\nPOST http://localhost:8080/api/logout\r\n\r\nIf visit the service directly, for instance the step 2, then return an error with 401.\r\nUseful SQL to insert a user into db:\r\n\r\n\r\nINSERT INTO `oscradb`.`employee` (`id`, `created`, `updated`, `city`, `email`, `civility`, `first_name`, `last_name`, `password`, `phone_number`, `role`, `enabled`) VALUES ('1', '20160929', '20160929', 'paris', 'user', 'MALE', 'test1', 'test2', '$2a$10$EblZqNptyYvcLm/VwDCVAuBjzZOI7khzdyGPBr08PpIi0na624b8.', '0699785546', 'USER', 'TRUE');\r\n\r\n\r\n======================================================================\r\n\r\nReplace model User by Employee, in order to avoid the conflict with the class User in Spring Security Core.\r\n","created_at":"2016-09-29T13:04:29Z","updated_at":"2016-10-03T19:58:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"213a1bfb9a332cefb583b559d897814dbf23c83d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/shine1982/oscra-api/pulls/1/commits","review_comments_url":"https://api.github.com/repos/shine1982/oscra-api/pulls/1/comments","review_comment_url":"https://api.github.com/repos/shine1982/oscra-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shine1982/oscra-api/issues/1/comments","statuses_url":"https://api.github.com/repos/shine1982/oscra-api/statuses/54f8517856463151576683a5d79f9d5e643313ab","head":{"label":"shine1982:RestSecurity","ref":"RestSecurity","sha":"54f8517856463151576683a5d79f9d5e643313ab","user":{"login":"shine1982","id":1681270,"avatar_url":"https://avatars.githubusercontent.com/u/1681270?v=3","gravatar_id":"","url":"https://api.github.com/users/shine1982","html_url":"https://github.com/shine1982","followers_url":"https://api.github.com/users/shine1982/followers","following_url":"https://api.github.com/users/shine1982/following{/other_user}","gists_url":"https://api.github.com/users/shine1982/gists{/gist_id}","starred_url":"https://api.github.com/users/shine1982/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shine1982/subscriptions","organizations_url":"https://api.github.com/users/shine1982/orgs","repos_url":"https://api.github.com/users/shine1982/repos","events_url":"https://api.github.com/users/shine1982/events{/privacy}","received_events_url":"https://api.github.com/users/shine1982/received_events","type":"User","site_admin":false},"repo":{"id":68532224,"name":"oscra-api","full_name":"shine1982/oscra-api","owner":{"login":"shine1982","id":1681270,"avatar_url":"https://avatars.githubusercontent.com/u/1681270?v=3","gravatar_id":"","url":"https://api.github.com/users/shine1982","html_url":"https://github.com/shine1982","followers_url":"https://api.github.com/users/shine1982/followers","following_url":"https://api.github.com/users/shine1982/following{/other_user}","gists_url":"https://api.github.com/users/shine1982/gists{/gist_id}","starred_url":"https://api.github.com/users/shine1982/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shine1982/subscriptions","organizations_url":"https://api.github.com/users/shine1982/orgs","repos_url":"https://api.github.com/users/shine1982/repos","events_url":"https://api.github.com/users/shine1982/events{/privacy}","received_events_url":"https://api.github.com/users/shine1982/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shine1982/oscra-api","description":"oscra API","fork":false,"url":"https://api.github.com/repos/shine1982/oscra-api","forks_url":"https://api.github.com/repos/shine1982/oscra-api/forks","keys_url":"https://api.github.com/repos/shine1982/oscra-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shine1982/oscra-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shine1982/oscra-api/teams","hooks_url":"https://api.github.com/repos/shine1982/oscra-api/hooks","issue_events_url":"https://api.github.com/repos/shine1982/oscra-api/issues/events{/number}","events_url":"https://api.github.com/repos/shine1982/oscra-api/events","assignees_url":"https://api.github.com/repos/shine1982/oscra-api/assignees{/user}","branches_url":"https://api.github.com/repos/shine1982/oscra-api/branches{/branch}","tags_url":"https://api.github.com/repos/shine1982/oscra-api/tags","blobs_url":"https://api.github.com/repos/shine1982/oscra-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shine1982/oscra-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shine1982/oscra-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/shine1982/oscra-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shine1982/oscra-api/statuses/{sha}","languages_url":"https://api.github.com/repos/shine1982/oscra-api/languages","stargazers_url":"https://api.github.com/repos/shine1982/oscra-api/stargazers","contributors_url":"https://api.github.com/repos/shine1982/oscra-api/contributors","subscribers_url":"https://api.github.com/repos/shine1982/oscra-api/subscribers","subscription_url":"https://api.github.com/repos/shine1982/oscra-api/subscription","commits_url":"https://api.github.com/repos/shine1982/oscra-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/shine1982/oscra-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/shine1982/oscra-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/shine1982/oscra-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/shine1982/oscra-api/contents/{+path}","compare_url":"https://api.github.com/repos/shine1982/oscra-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shine1982/oscra-api/merges","archive_url":"https://api.github.com/repos/shine1982/oscra-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shine1982/oscra-api/downloads","issues_url":"https://api.github.com/repos/shine1982/oscra-api/issues{/number}","pulls_url":"https://api.github.com/repos/shine1982/oscra-api/pulls{/number}","milestones_url":"https://api.github.com/repos/shine1982/oscra-api/milestones{/number}","notifications_url":"https://api.github.com/repos/shine1982/oscra-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shine1982/oscra-api/labels{/name}","releases_url":"https://api.github.com/repos/shine1982/oscra-api/releases{/id}","deployments_url":"https://api.github.com/repos/shine1982/oscra-api/deployments","created_at":"2016-09-18T16:10:12Z","updated_at":"2016-09-18T16:26:07Z","pushed_at":"2016-10-03T13:43:36Z","git_url":"git://github.com/shine1982/oscra-api.git","ssh_url":"git@github.com:shine1982/oscra-api.git","clone_url":"https://github.com/shine1982/oscra-api.git","svn_url":"https://github.com/shine1982/oscra-api","homepage":null,"size":58,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"shine1982:master","ref":"master","sha":"36c29acf74f75a5a6b804371332c7dffa47e7b18","user":{"login":"shine1982","id":1681270,"avatar_url":"https://avatars.githubusercontent.com/u/1681270?v=3","gravatar_id":"","url":"https://api.github.com/users/shine1982","html_url":"https://github.com/shine1982","followers_url":"https://api.github.com/users/shine1982/followers","following_url":"https://api.github.com/users/shine1982/following{/other_user}","gists_url":"https://api.github.com/users/shine1982/gists{/gist_id}","starred_url":"https://api.github.com/users/shine1982/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shine1982/subscriptions","organizations_url":"https://api.github.com/users/shine1982/orgs","repos_url":"https://api.github.com/users/shine1982/repos","events_url":"https://api.github.com/users/shine1982/events{/privacy}","received_events_url":"https://api.github.com/users/shine1982/received_events","type":"User","site_admin":false},"repo":{"id":68532224,"name":"oscra-api","full_name":"shine1982/oscra-api","owner":{"login":"shine1982","id":1681270,"avatar_url":"https://avatars.githubusercontent.com/u/1681270?v=3","gravatar_id":"","url":"https://api.github.com/users/shine1982","html_url":"https://github.com/shine1982","followers_url":"https://api.github.com/users/shine1982/followers","following_url":"https://api.github.com/users/shine1982/following{/other_user}","gists_url":"https://api.github.com/users/shine1982/gists{/gist_id}","starred_url":"https://api.github.com/users/shine1982/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shine1982/subscriptions","organizations_url":"https://api.github.com/users/shine1982/orgs","repos_url":"https://api.github.com/users/shine1982/repos","events_url":"https://api.github.com/users/shine1982/events{/privacy}","received_events_url":"https://api.github.com/users/shine1982/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shine1982/oscra-api","description":"oscra API","fork":false,"url":"https://api.github.com/repos/shine1982/oscra-api","forks_url":"https://api.github.com/repos/shine1982/oscra-api/forks","keys_url":"https://api.github.com/repos/shine1982/oscra-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shine1982/oscra-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shine1982/oscra-api/teams","hooks_url":"https://api.github.com/repos/shine1982/oscra-api/hooks","issue_events_url":"https://api.github.com/repos/shine1982/oscra-api/issues/events{/number}","events_url":"https://api.github.com/repos/shine1982/oscra-api/events","assignees_url":"https://api.github.com/repos/shine1982/oscra-api/assignees{/user}","branches_url":"https://api.github.com/repos/shine1982/oscra-api/branches{/branch}","tags_url":"https://api.github.com/repos/shine1982/oscra-api/tags","blobs_url":"https://api.github.com/repos/shine1982/oscra-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shine1982/oscra-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shine1982/oscra-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/shine1982/oscra-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shine1982/oscra-api/statuses/{sha}","languages_url":"https://api.github.com/repos/shine1982/oscra-api/languages","stargazers_url":"https://api.github.com/repos/shine1982/oscra-api/stargazers","contributors_url":"https://api.github.com/repos/shine1982/oscra-api/contributors","subscribers_url":"https://api.github.com/repos/shine1982/oscra-api/subscribers","subscription_url":"https://api.github.com/repos/shine1982/oscra-api/subscription","commits_url":"https://api.github.com/repos/shine1982/oscra-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/shine1982/oscra-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/shine1982/oscra-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/shine1982/oscra-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/shine1982/oscra-api/contents/{+path}","compare_url":"https://api.github.com/repos/shine1982/oscra-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shine1982/oscra-api/merges","archive_url":"https://api.github.com/repos/shine1982/oscra-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shine1982/oscra-api/downloads","issues_url":"https://api.github.com/repos/shine1982/oscra-api/issues{/number}","pulls_url":"https://api.github.com/repos/shine1982/oscra-api/pulls{/number}","milestones_url":"https://api.github.com/repos/shine1982/oscra-api/milestones{/number}","notifications_url":"https://api.github.com/repos/shine1982/oscra-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shine1982/oscra-api/labels{/name}","releases_url":"https://api.github.com/repos/shine1982/oscra-api/releases{/id}","deployments_url":"https://api.github.com/repos/shine1982/oscra-api/deployments","created_at":"2016-09-18T16:10:12Z","updated_at":"2016-09-18T16:26:07Z","pushed_at":"2016-10-03T13:43:36Z","git_url":"git://github.com/shine1982/oscra-api.git","ssh_url":"git@github.com:shine1982/oscra-api.git","clone_url":"https://github.com/shine1982/oscra-api.git","svn_url":"https://github.com/shine1982/oscra-api","homepage":null,"size":58,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shine1982/oscra-api/pulls/1"},"html":{"href":"https://github.com/shine1982/oscra-api/pull/1"},"issue":{"href":"https://api.github.com/repos/shine1982/oscra-api/issues/1"},"comments":{"href":"https://api.github.com/repos/shine1982/oscra-api/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/shine1982/oscra-api/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/shine1982/oscra-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shine1982/oscra-api/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/shine1982/oscra-api/statuses/54f8517856463151576683a5d79f9d5e643313ab"}}}}
{"actor":{"display_login":"shine1982"}}