{"action":"created","comment":{"url":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls/comments/192851084","pull_request_review_id":125706766,"id":192851084,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5Mjg1MTA4NA==","diff_hunk":"@@ -3,36 +3,35 @@\n const config = require('../config/config');\n const hapiAuthJwt2 = require('hapi-auth-jwt2');\n \n-function validate (decoded) {\n-  // This should be enough to validate that the id is a UUID without any lib or regex involved\n-  const UUID_LENGTH = 36;\n-  const isValid = (decoded.id.length === UUID_LENGTH);\n-  return { isValid };\n-};\n-\n-function validateAnonymous () {\n-  return { isValid: true };\n-};\n-\n module.exports = {\n-  name: 'huitparfaitAuth',\n+  name: 'jwt.auth',\n   async register (server) {\n \n     await server.register(hapiAuthJwt2);\n \n     server.auth.strategy('jwt', 'jwt', {\n       key: config.get('JWT_PUBLIC_KEY'),\n-      validate: validate,\n+      validate: validateToken,\n       verifyOptions: { algorithms: ['RS512'] },\n     });\n \n     server.auth.strategy('jwt-anonymous', 'jwt', {\n       key: config.get('JWT_PUBLIC_KEY'),\n-      validate: validateAnonymous,\n+      validate: validateAnonymousToken,\n       verifyOptions: { algorithms: ['RS512'] },\n     });\n \n     server.auth.default('jwt');\n-\n   },\n };\n+\n+function validateToken (decoded) {\n+  // This should be enough to validate that the id is a UUID without any lib or regex involved\n+  const UUID_LENGTH = 36;\n+  const isValid = (decoded.id.length === UUID_LENGTH);\n+  return { isValid };\n+};\n+\n+function validateAnonymousToken () {\n+  return { isValid: true };\n+};","path":"src/auth/jwt.auth.js","position":61,"original_position":50,"commit_id":"14fd44b4bc346c6c3b0cfa99bc6b6b796352f69b","original_commit_id":"d6d6397a0d63c567f61a314b1d951b01f83b807b","user":{"login":"hsablonniere","id":236342,"node_id":"MDQ6VXNlcjIzNjM0Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/236342?v=4","gravatar_id":"","url":"https://api.github.com/users/hsablonniere","html_url":"https://github.com/hsablonniere","followers_url":"https://api.github.com/users/hsablonniere/followers","following_url":"https://api.github.com/users/hsablonniere/following{/other_user}","gists_url":"https://api.github.com/users/hsablonniere/gists{/gist_id}","starred_url":"https://api.github.com/users/hsablonniere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hsablonniere/subscriptions","organizations_url":"https://api.github.com/users/hsablonniere/orgs","repos_url":"https://api.github.com/users/hsablonniere/repos","events_url":"https://api.github.com/users/hsablonniere/events{/privacy}","received_events_url":"https://api.github.com/users/hsablonniere/received_events","type":"User","site_admin":false},"body":"En fait, dans la gateway, j'ai 2 types d'auth :\r\n\r\n* `social-auth.auth.js`\r\n* `session-cookie.auth.js`\r\n\r\nC'est pour ça que du coup, je me suis dit qu'il nous fallait `jwt.auth.js`.","created_at":"2018-06-04T19:16:04Z","updated_at":"2018-06-04T19:16:05Z","html_url":"https://github.com/huitparfait/huitparfait-api/pull/3#discussion_r192851084","pull_request_url":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls/3","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls/comments/192851084"},"html":{"href":"https://github.com/huitparfait/huitparfait-api/pull/3#discussion_r192851084"},"pull_request":{"href":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls/3"}},"in_reply_to_id":192843558},"pull_request":{"url":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls/3","id":192479154,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyNDc5MTU0","html_url":"https://github.com/huitparfait/huitparfait-api/pull/3","diff_url":"https://github.com/huitparfait/huitparfait-api/pull/3.diff","patch_url":"https://github.com/huitparfait/huitparfait-api/pull/3.patch","issue_url":"https://api.github.com/repos/huitparfait/huitparfait-api/issues/3","number":3,"state":"open","locked":false,"title":"Various feedbacks, nit picking and propositions","user":{"login":"hsablonniere","id":236342,"node_id":"MDQ6VXNlcjIzNjM0Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/236342?v=4","gravatar_id":"","url":"https://api.github.com/users/hsablonniere","html_url":"https://github.com/hsablonniere","followers_url":"https://api.github.com/users/hsablonniere/followers","following_url":"https://api.github.com/users/hsablonniere/following{/other_user}","gists_url":"https://api.github.com/users/hsablonniere/gists{/gist_id}","starred_url":"https://api.github.com/users/hsablonniere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hsablonniere/subscriptions","organizations_url":"https://api.github.com/users/hsablonniere/orgs","repos_url":"https://api.github.com/users/hsablonniere/repos","events_url":"https://api.github.com/users/hsablonniere/events{/privacy}","received_events_url":"https://api.github.com/users/hsablonniere/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-04T17:37:15Z","updated_at":"2018-06-04T19:16:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"49158a92791ec1f22ee3dc1f2c8f6f23c1162492","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls/3/commits","review_comments_url":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls/3/comments","review_comment_url":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/huitparfait/huitparfait-api/issues/3/comments","statuses_url":"https://api.github.com/repos/huitparfait/huitparfait-api/statuses/14fd44b4bc346c6c3b0cfa99bc6b6b796352f69b","head":{"label":"huitparfait:feedbacks-for-pr-2","ref":"feedbacks-for-pr-2","sha":"14fd44b4bc346c6c3b0cfa99bc6b6b796352f69b","user":{"login":"huitparfait","id":19346031,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MzQ2MDMx","avatar_url":"https://avatars0.githubusercontent.com/u/19346031?v=4","gravatar_id":"","url":"https://api.github.com/users/huitparfait","html_url":"https://github.com/huitparfait","followers_url":"https://api.github.com/users/huitparfait/followers","following_url":"https://api.github.com/users/huitparfait/following{/other_user}","gists_url":"https://api.github.com/users/huitparfait/gists{/gist_id}","starred_url":"https://api.github.com/users/huitparfait/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huitparfait/subscriptions","organizations_url":"https://api.github.com/users/huitparfait/orgs","repos_url":"https://api.github.com/users/huitparfait/repos","events_url":"https://api.github.com/users/huitparfait/events{/privacy}","received_events_url":"https://api.github.com/users/huitparfait/received_events","type":"Organization","site_admin":false},"repo":{"id":135081184,"node_id":"MDEwOlJlcG9zaXRvcnkxMzUwODExODQ=","name":"huitparfait-api","full_name":"huitparfait/huitparfait-api","owner":{"login":"huitparfait","id":19346031,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MzQ2MDMx","avatar_url":"https://avatars0.githubusercontent.com/u/19346031?v=4","gravatar_id":"","url":"https://api.github.com/users/huitparfait","html_url":"https://github.com/huitparfait","followers_url":"https://api.github.com/users/huitparfait/followers","following_url":"https://api.github.com/users/huitparfait/following{/other_user}","gists_url":"https://api.github.com/users/huitparfait/gists{/gist_id}","starred_url":"https://api.github.com/users/huitparfait/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huitparfait/subscriptions","organizations_url":"https://api.github.com/users/huitparfait/orgs","repos_url":"https://api.github.com/users/huitparfait/repos","events_url":"https://api.github.com/users/huitparfait/events{/privacy}","received_events_url":"https://api.github.com/users/huitparfait/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/huitparfait/huitparfait-api","description":"REST API for huitparfait","fork":false,"url":"https://api.github.com/repos/huitparfait/huitparfait-api","forks_url":"https://api.github.com/repos/huitparfait/huitparfait-api/forks","keys_url":"https://api.github.com/repos/huitparfait/huitparfait-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/huitparfait/huitparfait-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/huitparfait/huitparfait-api/teams","hooks_url":"https://api.github.com/repos/huitparfait/huitparfait-api/hooks","issue_events_url":"https://api.github.com/repos/huitparfait/huitparfait-api/issues/events{/number}","events_url":"https://api.github.com/repos/huitparfait/huitparfait-api/events","assignees_url":"https://api.github.com/repos/huitparfait/huitparfait-api/assignees{/user}","branches_url":"https://api.github.com/repos/huitparfait/huitparfait-api/branches{/branch}","tags_url":"https://api.github.com/repos/huitparfait/huitparfait-api/tags","blobs_url":"https://api.github.com/repos/huitparfait/huitparfait-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/huitparfait/huitparfait-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/huitparfait/huitparfait-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/huitparfait/huitparfait-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/huitparfait/huitparfait-api/statuses/{sha}","languages_url":"https://api.github.com/repos/huitparfait/huitparfait-api/languages","stargazers_url":"https://api.github.com/repos/huitparfait/huitparfait-api/stargazers","contributors_url":"https://api.github.com/repos/huitparfait/huitparfait-api/contributors","subscribers_url":"https://api.github.com/repos/huitparfait/huitparfait-api/subscribers","subscription_url":"https://api.github.com/repos/huitparfait/huitparfait-api/subscription","commits_url":"https://api.github.com/repos/huitparfait/huitparfait-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/huitparfait/huitparfait-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/huitparfait/huitparfait-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/huitparfait/huitparfait-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/huitparfait/huitparfait-api/contents/{+path}","compare_url":"https://api.github.com/repos/huitparfait/huitparfait-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/huitparfait/huitparfait-api/merges","archive_url":"https://api.github.com/repos/huitparfait/huitparfait-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/huitparfait/huitparfait-api/downloads","issues_url":"https://api.github.com/repos/huitparfait/huitparfait-api/issues{/number}","pulls_url":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls{/number}","milestones_url":"https://api.github.com/repos/huitparfait/huitparfait-api/milestones{/number}","notifications_url":"https://api.github.com/repos/huitparfait/huitparfait-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/huitparfait/huitparfait-api/labels{/name}","releases_url":"https://api.github.com/repos/huitparfait/huitparfait-api/releases{/id}","deployments_url":"https://api.github.com/repos/huitparfait/huitparfait-api/deployments","created_at":"2018-05-27T20:59:15Z","updated_at":"2018-06-04T15:23:44Z","pushed_at":"2018-06-04T17:37:54Z","git_url":"git://github.com/huitparfait/huitparfait-api.git","ssh_url":"git@github.com:huitparfait/huitparfait-api.git","clone_url":"https://github.com/huitparfait/huitparfait-api.git","svn_url":"https://github.com/huitparfait/huitparfait-api","homepage":"","size":243,"stargazers_count":0,"watchers_count":0,"language":"HTML","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":"huitparfait:master","ref":"master","sha":"d57ccaaa351236cc3a396216304c19f1e515304b","user":{"login":"huitparfait","id":19346031,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MzQ2MDMx","avatar_url":"https://avatars0.githubusercontent.com/u/19346031?v=4","gravatar_id":"","url":"https://api.github.com/users/huitparfait","html_url":"https://github.com/huitparfait","followers_url":"https://api.github.com/users/huitparfait/followers","following_url":"https://api.github.com/users/huitparfait/following{/other_user}","gists_url":"https://api.github.com/users/huitparfait/gists{/gist_id}","starred_url":"https://api.github.com/users/huitparfait/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huitparfait/subscriptions","organizations_url":"https://api.github.com/users/huitparfait/orgs","repos_url":"https://api.github.com/users/huitparfait/repos","events_url":"https://api.github.com/users/huitparfait/events{/privacy}","received_events_url":"https://api.github.com/users/huitparfait/received_events","type":"Organization","site_admin":false},"repo":{"id":135081184,"node_id":"MDEwOlJlcG9zaXRvcnkxMzUwODExODQ=","name":"huitparfait-api","full_name":"huitparfait/huitparfait-api","owner":{"login":"huitparfait","id":19346031,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MzQ2MDMx","avatar_url":"https://avatars0.githubusercontent.com/u/19346031?v=4","gravatar_id":"","url":"https://api.github.com/users/huitparfait","html_url":"https://github.com/huitparfait","followers_url":"https://api.github.com/users/huitparfait/followers","following_url":"https://api.github.com/users/huitparfait/following{/other_user}","gists_url":"https://api.github.com/users/huitparfait/gists{/gist_id}","starred_url":"https://api.github.com/users/huitparfait/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huitparfait/subscriptions","organizations_url":"https://api.github.com/users/huitparfait/orgs","repos_url":"https://api.github.com/users/huitparfait/repos","events_url":"https://api.github.com/users/huitparfait/events{/privacy}","received_events_url":"https://api.github.com/users/huitparfait/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/huitparfait/huitparfait-api","description":"REST API for huitparfait","fork":false,"url":"https://api.github.com/repos/huitparfait/huitparfait-api","forks_url":"https://api.github.com/repos/huitparfait/huitparfait-api/forks","keys_url":"https://api.github.com/repos/huitparfait/huitparfait-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/huitparfait/huitparfait-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/huitparfait/huitparfait-api/teams","hooks_url":"https://api.github.com/repos/huitparfait/huitparfait-api/hooks","issue_events_url":"https://api.github.com/repos/huitparfait/huitparfait-api/issues/events{/number}","events_url":"https://api.github.com/repos/huitparfait/huitparfait-api/events","assignees_url":"https://api.github.com/repos/huitparfait/huitparfait-api/assignees{/user}","branches_url":"https://api.github.com/repos/huitparfait/huitparfait-api/branches{/branch}","tags_url":"https://api.github.com/repos/huitparfait/huitparfait-api/tags","blobs_url":"https://api.github.com/repos/huitparfait/huitparfait-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/huitparfait/huitparfait-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/huitparfait/huitparfait-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/huitparfait/huitparfait-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/huitparfait/huitparfait-api/statuses/{sha}","languages_url":"https://api.github.com/repos/huitparfait/huitparfait-api/languages","stargazers_url":"https://api.github.com/repos/huitparfait/huitparfait-api/stargazers","contributors_url":"https://api.github.com/repos/huitparfait/huitparfait-api/contributors","subscribers_url":"https://api.github.com/repos/huitparfait/huitparfait-api/subscribers","subscription_url":"https://api.github.com/repos/huitparfait/huitparfait-api/subscription","commits_url":"https://api.github.com/repos/huitparfait/huitparfait-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/huitparfait/huitparfait-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/huitparfait/huitparfait-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/huitparfait/huitparfait-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/huitparfait/huitparfait-api/contents/{+path}","compare_url":"https://api.github.com/repos/huitparfait/huitparfait-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/huitparfait/huitparfait-api/merges","archive_url":"https://api.github.com/repos/huitparfait/huitparfait-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/huitparfait/huitparfait-api/downloads","issues_url":"https://api.github.com/repos/huitparfait/huitparfait-api/issues{/number}","pulls_url":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls{/number}","milestones_url":"https://api.github.com/repos/huitparfait/huitparfait-api/milestones{/number}","notifications_url":"https://api.github.com/repos/huitparfait/huitparfait-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/huitparfait/huitparfait-api/labels{/name}","releases_url":"https://api.github.com/repos/huitparfait/huitparfait-api/releases{/id}","deployments_url":"https://api.github.com/repos/huitparfait/huitparfait-api/deployments","created_at":"2018-05-27T20:59:15Z","updated_at":"2018-06-04T15:23:44Z","pushed_at":"2018-06-04T17:37:54Z","git_url":"git://github.com/huitparfait/huitparfait-api.git","ssh_url":"git@github.com:huitparfait/huitparfait-api.git","clone_url":"https://github.com/huitparfait/huitparfait-api.git","svn_url":"https://github.com/huitparfait/huitparfait-api","homepage":"","size":243,"stargazers_count":0,"watchers_count":0,"language":"HTML","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/huitparfait/huitparfait-api/pulls/3"},"html":{"href":"https://github.com/huitparfait/huitparfait-api/pull/3"},"issue":{"href":"https://api.github.com/repos/huitparfait/huitparfait-api/issues/3"},"comments":{"href":"https://api.github.com/repos/huitparfait/huitparfait-api/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/huitparfait/huitparfait-api/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/huitparfait/huitparfait-api/statuses/14fd44b4bc346c6c3b0cfa99bc6b6b796352f69b"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"hsablonniere"}}