{"action":"created","comment":{"url":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/comments/66154726","id":66154726,"diff_hunk":"@@ -127,31 +119,37 @@ protected function buildClaims()\n \n         // add the default claims\n         foreach ($this->defaultClaims as $claim) {\n-            $this->addClaim($claim, $this->$claim());\n+            $this->addClaim($claim, $this->claimFactory->make($claim));\n         }\n \n         // add custom claims on top, allowing them to overwrite defaults\n         $this->addClaims($this->getCustomClaims());","path":"src/Factory.php","position":61,"original_position":61,"commit_id":"217a68fdeebc0e5a1e3b53da5d4ce3b09a886b40","original_commit_id":"217a68fdeebc0e5a1e3b53da5d4ce3b09a886b40","user":{"login":"tdhsmith","id":1791252,"avatar_url":"https://avatars.githubusercontent.com/u/1791252?v=3","gravatar_id":"","url":"https://api.github.com/users/tdhsmith","html_url":"https://github.com/tdhsmith","followers_url":"https://api.github.com/users/tdhsmith/followers","following_url":"https://api.github.com/users/tdhsmith/following{/other_user}","gists_url":"https://api.github.com/users/tdhsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/tdhsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdhsmith/subscriptions","organizations_url":"https://api.github.com/users/tdhsmith/orgs","repos_url":"https://api.github.com/users/tdhsmith/repos","events_url":"https://api.github.com/users/tdhsmith/events{/privacy}","received_events_url":"https://api.github.com/users/tdhsmith/received_events","type":"User","site_admin":false},"body":"Feature: have custom claims use the claim factory as well.\r\n\r\nThe custom claims in this factory don't necessarily mean \"custom\" in the sense of the `Custom` claim. The user might still have defined a special claim class with validation and behavior. So in that sense they're more like \"additional\" claims beyond the default set, and it would be nice if there were a way to still run through their classes' constructors/methods.\r\n\r\nAdditionally, if you support moving the defaults into the claims, you could allow unkeyed array entries that are just claim names. So this would work:\r\n```php\r\nFactory::customClaims(['name' => 'myApplication', 'cnf'])->make();\r\n// if those exist in the class map, would result in claim Factory running:\r\n$classMap['name']->setValue('myApplication');\r\n$classMap['cnf']->setDefault();\r\n```\r\n(Although technically detecting that probably requires removing support for numerically-named claims.)","created_at":"2016-06-07T21:18:02Z","updated_at":"2016-06-07T21:18:02Z","html_url":"https://github.com/tymondesigns/jwt-auth/pull/746#discussion_r66154726","pull_request_url":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/746","_links":{"self":{"href":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/comments/66154726"},"html":{"href":"https://github.com/tymondesigns/jwt-auth/pull/746#discussion_r66154726"},"pull_request":{"href":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/746"}}},"pull_request":{"url":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/746","id":72636621,"html_url":"https://github.com/tymondesigns/jwt-auth/pull/746","diff_url":"https://github.com/tymondesigns/jwt-auth/pull/746.diff","patch_url":"https://github.com/tymondesigns/jwt-auth/pull/746.patch","issue_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/746","number":746,"state":"open","locked":false,"title":"Refactor [feedback wanted]","user":{"login":"tymondesigns","id":1801923,"avatar_url":"https://avatars.githubusercontent.com/u/1801923?v=3","gravatar_id":"","url":"https://api.github.com/users/tymondesigns","html_url":"https://github.com/tymondesigns","followers_url":"https://api.github.com/users/tymondesigns/followers","following_url":"https://api.github.com/users/tymondesigns/following{/other_user}","gists_url":"https://api.github.com/users/tymondesigns/gists{/gist_id}","starred_url":"https://api.github.com/users/tymondesigns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tymondesigns/subscriptions","organizations_url":"https://api.github.com/users/tymondesigns/orgs","repos_url":"https://api.github.com/users/tymondesigns/repos","events_url":"https://api.github.com/users/tymondesigns/events{/privacy}","received_events_url":"https://api.github.com/users/tymondesigns/received_events","type":"User","site_admin":false},"body":"@tdhsmith @lucasmichot and others!\r\n\r\nI would love to get your initial thoughts on the approach I have taken here...\r\n\r\nThis is by no means ready for a merge! but I think it's a step in the right direction. There is much more work to do on this - (the tests are nowhere near green and there's bound to be some bugs).\r\n\r\nAs I say, just wanted to get some thoughts on the drastic change. I was inspired by #735 to begin this, so just want some feedback in case I have introduced any obvious flaws with this approach.\r\n\r\nEssentially, Claims are now responsible for the validation of themselves within various contexts.. (creation, when checking the validity of a payload, and refreshing).\r\n\r\nAnd the Claim factory is now responsible for creating the initial Claim instances (except the `jti`).\r\n\r\nAnd lots more tweaks...\r\n\r\nI welcome your comments!\r\n\r\nAny further clarifications, let me know\r\n\r\nThanks\r\n","created_at":"2016-06-05T18:31:47Z","updated_at":"2016-06-07T21:18:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"48d2f56062a89c453249fb1cdafcc6665808c014","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/746/commits","review_comments_url":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/746/comments","review_comment_url":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/746/comments","statuses_url":"https://api.github.com/repos/tymondesigns/jwt-auth/statuses/217a68fdeebc0e5a1e3b53da5d4ce3b09a886b40","head":{"label":"tymondesigns:refactor","ref":"refactor","sha":"217a68fdeebc0e5a1e3b53da5d4ce3b09a886b40","user":{"login":"tymondesigns","id":1801923,"avatar_url":"https://avatars.githubusercontent.com/u/1801923?v=3","gravatar_id":"","url":"https://api.github.com/users/tymondesigns","html_url":"https://github.com/tymondesigns","followers_url":"https://api.github.com/users/tymondesigns/followers","following_url":"https://api.github.com/users/tymondesigns/following{/other_user}","gists_url":"https://api.github.com/users/tymondesigns/gists{/gist_id}","starred_url":"https://api.github.com/users/tymondesigns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tymondesigns/subscriptions","organizations_url":"https://api.github.com/users/tymondesigns/orgs","repos_url":"https://api.github.com/users/tymondesigns/repos","events_url":"https://api.github.com/users/tymondesigns/events{/privacy}","received_events_url":"https://api.github.com/users/tymondesigns/received_events","type":"User","site_admin":false},"repo":{"id":23680678,"name":"jwt-auth","full_name":"tymondesigns/jwt-auth","owner":{"login":"tymondesigns","id":1801923,"avatar_url":"https://avatars.githubusercontent.com/u/1801923?v=3","gravatar_id":"","url":"https://api.github.com/users/tymondesigns","html_url":"https://github.com/tymondesigns","followers_url":"https://api.github.com/users/tymondesigns/followers","following_url":"https://api.github.com/users/tymondesigns/following{/other_user}","gists_url":"https://api.github.com/users/tymondesigns/gists{/gist_id}","starred_url":"https://api.github.com/users/tymondesigns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tymondesigns/subscriptions","organizations_url":"https://api.github.com/users/tymondesigns/orgs","repos_url":"https://api.github.com/users/tymondesigns/repos","events_url":"https://api.github.com/users/tymondesigns/events{/privacy}","received_events_url":"https://api.github.com/users/tymondesigns/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tymondesigns/jwt-auth","description":"JSON Web Token Authentication for Laravel & Lumen","fork":false,"url":"https://api.github.com/repos/tymondesigns/jwt-auth","forks_url":"https://api.github.com/repos/tymondesigns/jwt-auth/forks","keys_url":"https://api.github.com/repos/tymondesigns/jwt-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tymondesigns/jwt-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tymondesigns/jwt-auth/teams","hooks_url":"https://api.github.com/repos/tymondesigns/jwt-auth/hooks","issue_events_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/events{/number}","events_url":"https://api.github.com/repos/tymondesigns/jwt-auth/events","assignees_url":"https://api.github.com/repos/tymondesigns/jwt-auth/assignees{/user}","branches_url":"https://api.github.com/repos/tymondesigns/jwt-auth/branches{/branch}","tags_url":"https://api.github.com/repos/tymondesigns/jwt-auth/tags","blobs_url":"https://api.github.com/repos/tymondesigns/jwt-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tymondesigns/jwt-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tymondesigns/jwt-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/tymondesigns/jwt-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tymondesigns/jwt-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/tymondesigns/jwt-auth/languages","stargazers_url":"https://api.github.com/repos/tymondesigns/jwt-auth/stargazers","contributors_url":"https://api.github.com/repos/tymondesigns/jwt-auth/contributors","subscribers_url":"https://api.github.com/repos/tymondesigns/jwt-auth/subscribers","subscription_url":"https://api.github.com/repos/tymondesigns/jwt-auth/subscription","commits_url":"https://api.github.com/repos/tymondesigns/jwt-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/tymondesigns/jwt-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/tymondesigns/jwt-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/tymondesigns/jwt-auth/contents/{+path}","compare_url":"https://api.github.com/repos/tymondesigns/jwt-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tymondesigns/jwt-auth/merges","archive_url":"https://api.github.com/repos/tymondesigns/jwt-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tymondesigns/jwt-auth/downloads","issues_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues{/number}","pulls_url":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/tymondesigns/jwt-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/tymondesigns/jwt-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tymondesigns/jwt-auth/labels{/name}","releases_url":"https://api.github.com/repos/tymondesigns/jwt-auth/releases{/id}","deployments_url":"https://api.github.com/repos/tymondesigns/jwt-auth/deployments","created_at":"2014-09-04T21:50:50Z","updated_at":"2016-06-07T18:05:21Z","pushed_at":"2016-06-07T12:31:45Z","git_url":"git://github.com/tymondesigns/jwt-auth.git","ssh_url":"git@github.com:tymondesigns/jwt-auth.git","clone_url":"https://github.com/tymondesigns/jwt-auth.git","svn_url":"https://github.com/tymondesigns/jwt-auth","homepage":"","size":1772,"stargazers_count":1998,"watchers_count":1998,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":270,"mirror_url":null,"open_issues_count":87,"forks":270,"open_issues":87,"watchers":1998,"default_branch":"develop"}},"base":{"label":"tymondesigns:develop","ref":"develop","sha":"d1ea25b294e5ab44ff0bf66bfd01e4c1420db7f1","user":{"login":"tymondesigns","id":1801923,"avatar_url":"https://avatars.githubusercontent.com/u/1801923?v=3","gravatar_id":"","url":"https://api.github.com/users/tymondesigns","html_url":"https://github.com/tymondesigns","followers_url":"https://api.github.com/users/tymondesigns/followers","following_url":"https://api.github.com/users/tymondesigns/following{/other_user}","gists_url":"https://api.github.com/users/tymondesigns/gists{/gist_id}","starred_url":"https://api.github.com/users/tymondesigns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tymondesigns/subscriptions","organizations_url":"https://api.github.com/users/tymondesigns/orgs","repos_url":"https://api.github.com/users/tymondesigns/repos","events_url":"https://api.github.com/users/tymondesigns/events{/privacy}","received_events_url":"https://api.github.com/users/tymondesigns/received_events","type":"User","site_admin":false},"repo":{"id":23680678,"name":"jwt-auth","full_name":"tymondesigns/jwt-auth","owner":{"login":"tymondesigns","id":1801923,"avatar_url":"https://avatars.githubusercontent.com/u/1801923?v=3","gravatar_id":"","url":"https://api.github.com/users/tymondesigns","html_url":"https://github.com/tymondesigns","followers_url":"https://api.github.com/users/tymondesigns/followers","following_url":"https://api.github.com/users/tymondesigns/following{/other_user}","gists_url":"https://api.github.com/users/tymondesigns/gists{/gist_id}","starred_url":"https://api.github.com/users/tymondesigns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tymondesigns/subscriptions","organizations_url":"https://api.github.com/users/tymondesigns/orgs","repos_url":"https://api.github.com/users/tymondesigns/repos","events_url":"https://api.github.com/users/tymondesigns/events{/privacy}","received_events_url":"https://api.github.com/users/tymondesigns/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tymondesigns/jwt-auth","description":"JSON Web Token Authentication for Laravel & Lumen","fork":false,"url":"https://api.github.com/repos/tymondesigns/jwt-auth","forks_url":"https://api.github.com/repos/tymondesigns/jwt-auth/forks","keys_url":"https://api.github.com/repos/tymondesigns/jwt-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tymondesigns/jwt-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tymondesigns/jwt-auth/teams","hooks_url":"https://api.github.com/repos/tymondesigns/jwt-auth/hooks","issue_events_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/events{/number}","events_url":"https://api.github.com/repos/tymondesigns/jwt-auth/events","assignees_url":"https://api.github.com/repos/tymondesigns/jwt-auth/assignees{/user}","branches_url":"https://api.github.com/repos/tymondesigns/jwt-auth/branches{/branch}","tags_url":"https://api.github.com/repos/tymondesigns/jwt-auth/tags","blobs_url":"https://api.github.com/repos/tymondesigns/jwt-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tymondesigns/jwt-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tymondesigns/jwt-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/tymondesigns/jwt-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tymondesigns/jwt-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/tymondesigns/jwt-auth/languages","stargazers_url":"https://api.github.com/repos/tymondesigns/jwt-auth/stargazers","contributors_url":"https://api.github.com/repos/tymondesigns/jwt-auth/contributors","subscribers_url":"https://api.github.com/repos/tymondesigns/jwt-auth/subscribers","subscription_url":"https://api.github.com/repos/tymondesigns/jwt-auth/subscription","commits_url":"https://api.github.com/repos/tymondesigns/jwt-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/tymondesigns/jwt-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/tymondesigns/jwt-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/tymondesigns/jwt-auth/contents/{+path}","compare_url":"https://api.github.com/repos/tymondesigns/jwt-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tymondesigns/jwt-auth/merges","archive_url":"https://api.github.com/repos/tymondesigns/jwt-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tymondesigns/jwt-auth/downloads","issues_url":"https://api.github.com/repos/tymondesigns/jwt-auth/issues{/number}","pulls_url":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/tymondesigns/jwt-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/tymondesigns/jwt-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tymondesigns/jwt-auth/labels{/name}","releases_url":"https://api.github.com/repos/tymondesigns/jwt-auth/releases{/id}","deployments_url":"https://api.github.com/repos/tymondesigns/jwt-auth/deployments","created_at":"2014-09-04T21:50:50Z","updated_at":"2016-06-07T18:05:21Z","pushed_at":"2016-06-07T12:31:45Z","git_url":"git://github.com/tymondesigns/jwt-auth.git","ssh_url":"git@github.com:tymondesigns/jwt-auth.git","clone_url":"https://github.com/tymondesigns/jwt-auth.git","svn_url":"https://github.com/tymondesigns/jwt-auth","homepage":"","size":1772,"stargazers_count":1998,"watchers_count":1998,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":270,"mirror_url":null,"open_issues_count":87,"forks":270,"open_issues":87,"watchers":1998,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/746"},"html":{"href":"https://github.com/tymondesigns/jwt-auth/pull/746"},"issue":{"href":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/746"},"comments":{"href":"https://api.github.com/repos/tymondesigns/jwt-auth/issues/746/comments"},"review_comments":{"href":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/746/comments"},"review_comment":{"href":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tymondesigns/jwt-auth/pulls/746/commits"},"statuses":{"href":"https://api.github.com/repos/tymondesigns/jwt-auth/statuses/217a68fdeebc0e5a1e3b53da5d4ce3b09a886b40"}}}}
{"actor":{"display_login":"tdhsmith"}}