{"action":"created","comment":{"url":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/comments/221369580","pull_request_review_id":160009239,"id":221369580,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTM2OTU4MA==","diff_hunk":"@@ -0,0 +1,64 @@\n+require 'rails_helper'\n+\n+RSpec.describe \"Authorization\", type: :request do\n+\n+  let(:valid_email) { \"sarasa@wyehome.com\" }\n+  let(:valid_subject) { { email: valid_email, user_id: 2 } }\n+  let(:valid_payload) do\n+    {\n+      sub: valid_subject,\n+      iss: Rails.configuration.jwt_iss,\n+      exp: Time.now.to_i + Rails.configuration.jwt_duration,\n+      nbf: Time.now.to_i - 4\n+    }\n+  end\n+\n+  let(:expired_payload) do\n+    {\n+      sub: valid_subject,\n+      iss: Rails.configuration.jwt_iss,\n+      exp: Time.now.to_i - 4,\n+      nbf: Time.now.to_i\n+    }\n+  end\n+\n+  let(:inmature_payload) do\n+    {\n+      sub: valid_subject,\n+      iss: Rails.configuration.jwt_iss,\n+      exp: Time.now.to_i + Rails.configuration.jwt_duration,\n+      nbf: Time.now.to_i + 9999\n+    }\n+  end\n+\n+  let(:valid_token) { JWT.encode(valid_payload, Rails.configuration.jwt_key, 'HS256') }\n+  let(:expired_token) { JWT.encode(expired_payload, Rails.configuration.jwt_key, 'HS256') }\n+  let(:inmature_token) { JWT.encode(inmature_payload, Rails.configuration.jwt_key, 'HS256') }\n+\n+  def headers(token)\n+    {\n+      Authorization: \"Bearer \" + token\n+    }\n+  end\n+\n+  describe \"GET /auth\" do\n+    context \"when token is valid\" do\n+      it \"returns status 204\" do\n+        get \"/auth\", headers: headers(valid_token)\n+        expect(response).to have_http_status(204)","path":"spec/requests/token_spec.rb","position":48,"original_position":48,"commit_id":"e099f45628bd415dfd4804c43bf73f4385e12e4f","original_commit_id":"e099f45628bd415dfd4804c43bf73f4385e12e4f","user":{"login":"Gimli76","id":9361123,"node_id":"MDQ6VXNlcjkzNjExMjM=","avatar_url":"https://avatars2.githubusercontent.com/u/9361123?v=4","gravatar_id":"","url":"https://api.github.com/users/Gimli76","html_url":"https://github.com/Gimli76","followers_url":"https://api.github.com/users/Gimli76/followers","following_url":"https://api.github.com/users/Gimli76/following{/other_user}","gists_url":"https://api.github.com/users/Gimli76/gists{/gist_id}","starred_url":"https://api.github.com/users/Gimli76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gimli76/subscriptions","organizations_url":"https://api.github.com/users/Gimli76/orgs","repos_url":"https://api.github.com/users/Gimli76/repos","events_url":"https://api.github.com/users/Gimli76/events{/privacy}","received_events_url":"https://api.github.com/users/Gimli76/received_events","type":"User","site_admin":false},"body":"This one is different from POST /auth. It just returns an empty response with status 204 (no content), so we can't check the token.\r\nIt's just an endpoint to check the token.","created_at":"2018-09-28T20:15:48Z","updated_at":"2018-09-28T20:15:48Z","html_url":"https://github.com/wyeworks/pis-wyehome/pull/19#discussion_r221369580","pull_request_url":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/19","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/comments/221369580"},"html":{"href":"https://github.com/wyeworks/pis-wyehome/pull/19#discussion_r221369580"},"pull_request":{"href":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/19"}},"in_reply_to_id":221357438},"pull_request":{"url":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/19","id":218811604,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4ODExNjA0","html_url":"https://github.com/wyeworks/pis-wyehome/pull/19","diff_url":"https://github.com/wyeworks/pis-wyehome/pull/19.diff","patch_url":"https://github.com/wyeworks/pis-wyehome/pull/19.patch","issue_url":"https://api.github.com/repos/wyeworks/pis-wyehome/issues/19","number":19,"state":"open","locked":false,"title":"Bug validar token sesion 160676014","user":{"login":"Gimli76","id":9361123,"node_id":"MDQ6VXNlcjkzNjExMjM=","avatar_url":"https://avatars2.githubusercontent.com/u/9361123?v=4","gravatar_id":"","url":"https://api.github.com/users/Gimli76","html_url":"https://github.com/Gimli76","followers_url":"https://api.github.com/users/Gimli76/followers","following_url":"https://api.github.com/users/Gimli76/following{/other_user}","gists_url":"https://api.github.com/users/Gimli76/gists{/gist_id}","starred_url":"https://api.github.com/users/Gimli76/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gimli76/subscriptions","organizations_url":"https://api.github.com/users/Gimli76/orgs","repos_url":"https://api.github.com/users/Gimli76/repos","events_url":"https://api.github.com/users/Gimli76/events{/privacy}","received_events_url":"https://api.github.com/users/Gimli76/received_events","type":"User","site_admin":false},"body":"Added authorization checks to all API calls (except POST /auth and GET /health).\r\n\r\nIf Authorization header is not present, authorization type is invalid or token is invalid, returns HTTP:401.\r\n\r\nIt is enabled by default to all endpoints , and must be explicitly skipped if the endpoint is public.","created_at":"2018-09-27T22:58:43Z","updated_at":"2018-09-28T20:15:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"554a0494c11605d72bf67bf7698a6768300d08db","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/19/commits","review_comments_url":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/19/comments","review_comment_url":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wyeworks/pis-wyehome/issues/19/comments","statuses_url":"https://api.github.com/repos/wyeworks/pis-wyehome/statuses/e099f45628bd415dfd4804c43bf73f4385e12e4f","head":{"label":"wyeworks:bug-validar_token_sesion-160676014","ref":"bug-validar_token_sesion-160676014","sha":"e099f45628bd415dfd4804c43bf73f4385e12e4f","user":{"login":"wyeworks","id":135745,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNTc0NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/135745?v=4","gravatar_id":"","url":"https://api.github.com/users/wyeworks","html_url":"https://github.com/wyeworks","followers_url":"https://api.github.com/users/wyeworks/followers","following_url":"https://api.github.com/users/wyeworks/following{/other_user}","gists_url":"https://api.github.com/users/wyeworks/gists{/gist_id}","starred_url":"https://api.github.com/users/wyeworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wyeworks/subscriptions","organizations_url":"https://api.github.com/users/wyeworks/orgs","repos_url":"https://api.github.com/users/wyeworks/repos","events_url":"https://api.github.com/users/wyeworks/events{/privacy}","received_events_url":"https://api.github.com/users/wyeworks/received_events","type":"Organization","site_admin":false},"repo":{"id":144744653,"node_id":"MDEwOlJlcG9zaXRvcnkxNDQ3NDQ2NTM=","name":"pis-wyehome","full_name":"wyeworks/pis-wyehome","private":false,"owner":{"login":"wyeworks","id":135745,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNTc0NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/135745?v=4","gravatar_id":"","url":"https://api.github.com/users/wyeworks","html_url":"https://github.com/wyeworks","followers_url":"https://api.github.com/users/wyeworks/followers","following_url":"https://api.github.com/users/wyeworks/following{/other_user}","gists_url":"https://api.github.com/users/wyeworks/gists{/gist_id}","starred_url":"https://api.github.com/users/wyeworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wyeworks/subscriptions","organizations_url":"https://api.github.com/users/wyeworks/orgs","repos_url":"https://api.github.com/users/wyeworks/repos","events_url":"https://api.github.com/users/wyeworks/events{/privacy}","received_events_url":"https://api.github.com/users/wyeworks/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/wyeworks/pis-wyehome","description":null,"fork":false,"url":"https://api.github.com/repos/wyeworks/pis-wyehome","forks_url":"https://api.github.com/repos/wyeworks/pis-wyehome/forks","keys_url":"https://api.github.com/repos/wyeworks/pis-wyehome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wyeworks/pis-wyehome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wyeworks/pis-wyehome/teams","hooks_url":"https://api.github.com/repos/wyeworks/pis-wyehome/hooks","issue_events_url":"https://api.github.com/repos/wyeworks/pis-wyehome/issues/events{/number}","events_url":"https://api.github.com/repos/wyeworks/pis-wyehome/events","assignees_url":"https://api.github.com/repos/wyeworks/pis-wyehome/assignees{/user}","branches_url":"https://api.github.com/repos/wyeworks/pis-wyehome/branches{/branch}","tags_url":"https://api.github.com/repos/wyeworks/pis-wyehome/tags","blobs_url":"https://api.github.com/repos/wyeworks/pis-wyehome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wyeworks/pis-wyehome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wyeworks/pis-wyehome/git/refs{/sha}","trees_url":"https://api.github.com/repos/wyeworks/pis-wyehome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wyeworks/pis-wyehome/statuses/{sha}","languages_url":"https://api.github.com/repos/wyeworks/pis-wyehome/languages","stargazers_url":"https://api.github.com/repos/wyeworks/pis-wyehome/stargazers","contributors_url":"https://api.github.com/repos/wyeworks/pis-wyehome/contributors","subscribers_url":"https://api.github.com/repos/wyeworks/pis-wyehome/subscribers","subscription_url":"https://api.github.com/repos/wyeworks/pis-wyehome/subscription","commits_url":"https://api.github.com/repos/wyeworks/pis-wyehome/commits{/sha}","git_commits_url":"https://api.github.com/repos/wyeworks/pis-wyehome/git/commits{/sha}","comments_url":"https://api.github.com/repos/wyeworks/pis-wyehome/comments{/number}","issue_comment_url":"https://api.github.com/repos/wyeworks/pis-wyehome/issues/comments{/number}","contents_url":"https://api.github.com/repos/wyeworks/pis-wyehome/contents/{+path}","compare_url":"https://api.github.com/repos/wyeworks/pis-wyehome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wyeworks/pis-wyehome/merges","archive_url":"https://api.github.com/repos/wyeworks/pis-wyehome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wyeworks/pis-wyehome/downloads","issues_url":"https://api.github.com/repos/wyeworks/pis-wyehome/issues{/number}","pulls_url":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls{/number}","milestones_url":"https://api.github.com/repos/wyeworks/pis-wyehome/milestones{/number}","notifications_url":"https://api.github.com/repos/wyeworks/pis-wyehome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wyeworks/pis-wyehome/labels{/name}","releases_url":"https://api.github.com/repos/wyeworks/pis-wyehome/releases{/id}","deployments_url":"https://api.github.com/repos/wyeworks/pis-wyehome/deployments","created_at":"2018-08-14T16:18:20Z","updated_at":"2018-09-27T17:15:37Z","pushed_at":"2018-09-28T19:54:09Z","git_url":"git://github.com/wyeworks/pis-wyehome.git","ssh_url":"git@github.com:wyeworks/pis-wyehome.git","clone_url":"https://github.com/wyeworks/pis-wyehome.git","svn_url":"https://github.com/wyeworks/pis-wyehome","homepage":null,"size":336,"stargazers_count":6,"watchers_count":6,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":1,"open_issues":3,"watchers":6,"default_branch":"master"}},"base":{"label":"wyeworks:development","ref":"development","sha":"550fb9cdc34de315ba0b93645917ca3709e3ecd0","user":{"login":"wyeworks","id":135745,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNTc0NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/135745?v=4","gravatar_id":"","url":"https://api.github.com/users/wyeworks","html_url":"https://github.com/wyeworks","followers_url":"https://api.github.com/users/wyeworks/followers","following_url":"https://api.github.com/users/wyeworks/following{/other_user}","gists_url":"https://api.github.com/users/wyeworks/gists{/gist_id}","starred_url":"https://api.github.com/users/wyeworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wyeworks/subscriptions","organizations_url":"https://api.github.com/users/wyeworks/orgs","repos_url":"https://api.github.com/users/wyeworks/repos","events_url":"https://api.github.com/users/wyeworks/events{/privacy}","received_events_url":"https://api.github.com/users/wyeworks/received_events","type":"Organization","site_admin":false},"repo":{"id":144744653,"node_id":"MDEwOlJlcG9zaXRvcnkxNDQ3NDQ2NTM=","name":"pis-wyehome","full_name":"wyeworks/pis-wyehome","private":false,"owner":{"login":"wyeworks","id":135745,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNTc0NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/135745?v=4","gravatar_id":"","url":"https://api.github.com/users/wyeworks","html_url":"https://github.com/wyeworks","followers_url":"https://api.github.com/users/wyeworks/followers","following_url":"https://api.github.com/users/wyeworks/following{/other_user}","gists_url":"https://api.github.com/users/wyeworks/gists{/gist_id}","starred_url":"https://api.github.com/users/wyeworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wyeworks/subscriptions","organizations_url":"https://api.github.com/users/wyeworks/orgs","repos_url":"https://api.github.com/users/wyeworks/repos","events_url":"https://api.github.com/users/wyeworks/events{/privacy}","received_events_url":"https://api.github.com/users/wyeworks/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/wyeworks/pis-wyehome","description":null,"fork":false,"url":"https://api.github.com/repos/wyeworks/pis-wyehome","forks_url":"https://api.github.com/repos/wyeworks/pis-wyehome/forks","keys_url":"https://api.github.com/repos/wyeworks/pis-wyehome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wyeworks/pis-wyehome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wyeworks/pis-wyehome/teams","hooks_url":"https://api.github.com/repos/wyeworks/pis-wyehome/hooks","issue_events_url":"https://api.github.com/repos/wyeworks/pis-wyehome/issues/events{/number}","events_url":"https://api.github.com/repos/wyeworks/pis-wyehome/events","assignees_url":"https://api.github.com/repos/wyeworks/pis-wyehome/assignees{/user}","branches_url":"https://api.github.com/repos/wyeworks/pis-wyehome/branches{/branch}","tags_url":"https://api.github.com/repos/wyeworks/pis-wyehome/tags","blobs_url":"https://api.github.com/repos/wyeworks/pis-wyehome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wyeworks/pis-wyehome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wyeworks/pis-wyehome/git/refs{/sha}","trees_url":"https://api.github.com/repos/wyeworks/pis-wyehome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wyeworks/pis-wyehome/statuses/{sha}","languages_url":"https://api.github.com/repos/wyeworks/pis-wyehome/languages","stargazers_url":"https://api.github.com/repos/wyeworks/pis-wyehome/stargazers","contributors_url":"https://api.github.com/repos/wyeworks/pis-wyehome/contributors","subscribers_url":"https://api.github.com/repos/wyeworks/pis-wyehome/subscribers","subscription_url":"https://api.github.com/repos/wyeworks/pis-wyehome/subscription","commits_url":"https://api.github.com/repos/wyeworks/pis-wyehome/commits{/sha}","git_commits_url":"https://api.github.com/repos/wyeworks/pis-wyehome/git/commits{/sha}","comments_url":"https://api.github.com/repos/wyeworks/pis-wyehome/comments{/number}","issue_comment_url":"https://api.github.com/repos/wyeworks/pis-wyehome/issues/comments{/number}","contents_url":"https://api.github.com/repos/wyeworks/pis-wyehome/contents/{+path}","compare_url":"https://api.github.com/repos/wyeworks/pis-wyehome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wyeworks/pis-wyehome/merges","archive_url":"https://api.github.com/repos/wyeworks/pis-wyehome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wyeworks/pis-wyehome/downloads","issues_url":"https://api.github.com/repos/wyeworks/pis-wyehome/issues{/number}","pulls_url":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls{/number}","milestones_url":"https://api.github.com/repos/wyeworks/pis-wyehome/milestones{/number}","notifications_url":"https://api.github.com/repos/wyeworks/pis-wyehome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wyeworks/pis-wyehome/labels{/name}","releases_url":"https://api.github.com/repos/wyeworks/pis-wyehome/releases{/id}","deployments_url":"https://api.github.com/repos/wyeworks/pis-wyehome/deployments","created_at":"2018-08-14T16:18:20Z","updated_at":"2018-09-27T17:15:37Z","pushed_at":"2018-09-28T19:54:09Z","git_url":"git://github.com/wyeworks/pis-wyehome.git","ssh_url":"git@github.com:wyeworks/pis-wyehome.git","clone_url":"https://github.com/wyeworks/pis-wyehome.git","svn_url":"https://github.com/wyeworks/pis-wyehome","homepage":null,"size":336,"stargazers_count":6,"watchers_count":6,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":1,"open_issues":3,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/19"},"html":{"href":"https://github.com/wyeworks/pis-wyehome/pull/19"},"issue":{"href":"https://api.github.com/repos/wyeworks/pis-wyehome/issues/19"},"comments":{"href":"https://api.github.com/repos/wyeworks/pis-wyehome/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wyeworks/pis-wyehome/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/wyeworks/pis-wyehome/statuses/e099f45628bd415dfd4804c43bf73f4385e12e4f"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Gimli76"}}