{"action":"opened","number":167,"pull_request":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/167","id":28620368,"html_url":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/167","diff_url":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/167.diff","patch_url":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/167.patch","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/167","number":167,"state":"open","locked":false,"title":"[wip] Added basic auth and oAuth2 in user context subscriber","user":{"login":"sprain","id":260361,"avatar_url":"https://avatars.githubusercontent.com/u/260361?v=3","gravatar_id":"","url":"https://api.github.com/users/sprain","html_url":"https://github.com/sprain","followers_url":"https://api.github.com/users/sprain/followers","following_url":"https://api.github.com/users/sprain/following{/other_user}","gists_url":"https://api.github.com/users/sprain/gists{/gist_id}","starred_url":"https://api.github.com/users/sprain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sprain/subscriptions","organizations_url":"https://api.github.com/users/sprain/orgs","repos_url":"https://api.github.com/users/sprain/repos","events_url":"https://api.github.com/users/sprain/events{/privacy}","received_events_url":"https://api.github.com/users/sprain/received_events","type":"User","site_admin":false},"body":"This is a draft for https://github.com/FriendsOfSymfony/FOSHttpCache/issues/147, feedback is welcome! Tests will be added once the approach is accepted (I am new to all this caching stuff).\r\n\r\nI added the functionality to determine whether a request is anonymous based on session, basic authentication or oAuth2.\r\n\r\nIn my Symfony2 app, to only use oAuth2, I would the overwrite `getDefaultSubscribers` in my own cache class like this:\r\n\r\n```php\r\nclass AppCache extends EventDispatchingHttpCache\r\n{\r\n    protected function getDefaultSubscribers()\r\n    {\r\n        $options = $this->getOptions();\r\n        $subscribers = array();\r\n        $defaultSubscribersOption = isset($options['fos_default_subscribers']) ? $options['fos_default_subscribers'] : self::SUBSCRIBER_ALL;\r\n        if ($defaultSubscribersOption & self::SUBSCRIBER_USER_CONTEXT) {\r\n            $subscribers[] = new UserContextSubscriber(array('authorization' => array('oauth2')));\r\n        }\r\n\r\n        return $subscribers;\r\n    }\r\n}\r\n```","created_at":"2015-02-04T08:22:10Z","updated_at":"2015-02-04T08:22:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/167/commits","review_comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/167/comments","review_comment_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/comments/{number}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/167/comments","statuses_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/statuses/61bcb77bf0dd901c9c119d93e7114cfa03171a81","head":{"label":"sprain:master","ref":"master","sha":"61bcb77bf0dd901c9c119d93e7114cfa03171a81","user":{"login":"sprain","id":260361,"avatar_url":"https://avatars.githubusercontent.com/u/260361?v=3","gravatar_id":"","url":"https://api.github.com/users/sprain","html_url":"https://github.com/sprain","followers_url":"https://api.github.com/users/sprain/followers","following_url":"https://api.github.com/users/sprain/following{/other_user}","gists_url":"https://api.github.com/users/sprain/gists{/gist_id}","starred_url":"https://api.github.com/users/sprain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sprain/subscriptions","organizations_url":"https://api.github.com/users/sprain/orgs","repos_url":"https://api.github.com/users/sprain/repos","events_url":"https://api.github.com/users/sprain/events{/privacy}","received_events_url":"https://api.github.com/users/sprain/received_events","type":"User","site_admin":false},"repo":{"id":30288467,"name":"FOSHttpCache","full_name":"sprain/FOSHttpCache","owner":{"login":"sprain","id":260361,"avatar_url":"https://avatars.githubusercontent.com/u/260361?v=3","gravatar_id":"","url":"https://api.github.com/users/sprain","html_url":"https://github.com/sprain","followers_url":"https://api.github.com/users/sprain/followers","following_url":"https://api.github.com/users/sprain/following{/other_user}","gists_url":"https://api.github.com/users/sprain/gists{/gist_id}","starred_url":"https://api.github.com/users/sprain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sprain/subscriptions","organizations_url":"https://api.github.com/users/sprain/orgs","repos_url":"https://api.github.com/users/sprain/repos","events_url":"https://api.github.com/users/sprain/events{/privacy}","received_events_url":"https://api.github.com/users/sprain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sprain/FOSHttpCache","description":"Integrate your PHP application with your HTTP caching proxy","fork":true,"url":"https://api.github.com/repos/sprain/FOSHttpCache","forks_url":"https://api.github.com/repos/sprain/FOSHttpCache/forks","keys_url":"https://api.github.com/repos/sprain/FOSHttpCache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sprain/FOSHttpCache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sprain/FOSHttpCache/teams","hooks_url":"https://api.github.com/repos/sprain/FOSHttpCache/hooks","issue_events_url":"https://api.github.com/repos/sprain/FOSHttpCache/issues/events{/number}","events_url":"https://api.github.com/repos/sprain/FOSHttpCache/events","assignees_url":"https://api.github.com/repos/sprain/FOSHttpCache/assignees{/user}","branches_url":"https://api.github.com/repos/sprain/FOSHttpCache/branches{/branch}","tags_url":"https://api.github.com/repos/sprain/FOSHttpCache/tags","blobs_url":"https://api.github.com/repos/sprain/FOSHttpCache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sprain/FOSHttpCache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sprain/FOSHttpCache/git/refs{/sha}","trees_url":"https://api.github.com/repos/sprain/FOSHttpCache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sprain/FOSHttpCache/statuses/{sha}","languages_url":"https://api.github.com/repos/sprain/FOSHttpCache/languages","stargazers_url":"https://api.github.com/repos/sprain/FOSHttpCache/stargazers","contributors_url":"https://api.github.com/repos/sprain/FOSHttpCache/contributors","subscribers_url":"https://api.github.com/repos/sprain/FOSHttpCache/subscribers","subscription_url":"https://api.github.com/repos/sprain/FOSHttpCache/subscription","commits_url":"https://api.github.com/repos/sprain/FOSHttpCache/commits{/sha}","git_commits_url":"https://api.github.com/repos/sprain/FOSHttpCache/git/commits{/sha}","comments_url":"https://api.github.com/repos/sprain/FOSHttpCache/comments{/number}","issue_comment_url":"https://api.github.com/repos/sprain/FOSHttpCache/issues/comments/{number}","contents_url":"https://api.github.com/repos/sprain/FOSHttpCache/contents/{+path}","compare_url":"https://api.github.com/repos/sprain/FOSHttpCache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sprain/FOSHttpCache/merges","archive_url":"https://api.github.com/repos/sprain/FOSHttpCache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sprain/FOSHttpCache/downloads","issues_url":"https://api.github.com/repos/sprain/FOSHttpCache/issues{/number}","pulls_url":"https://api.github.com/repos/sprain/FOSHttpCache/pulls{/number}","milestones_url":"https://api.github.com/repos/sprain/FOSHttpCache/milestones{/number}","notifications_url":"https://api.github.com/repos/sprain/FOSHttpCache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sprain/FOSHttpCache/labels{/name}","releases_url":"https://api.github.com/repos/sprain/FOSHttpCache/releases{/id}","created_at":"2015-02-04T08:14:44Z","updated_at":"2015-02-04T08:17:25Z","pushed_at":"2015-02-04T08:17:23Z","git_url":"git://github.com/sprain/FOSHttpCache.git","ssh_url":"git@github.com:sprain/FOSHttpCache.git","clone_url":"https://github.com/sprain/FOSHttpCache.git","svn_url":"https://github.com/sprain/FOSHttpCache","homepage":"http://foshttpcache.readthedocs.org/","size":2532,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"FriendsOfSymfony:master","ref":"master","sha":"e61d360142d5f9abe41efa1d27054bd02d3d71cb","user":{"login":"FriendsOfSymfony","id":529709,"avatar_url":"https://avatars.githubusercontent.com/u/529709?v=3","gravatar_id":"","url":"https://api.github.com/users/FriendsOfSymfony","html_url":"https://github.com/FriendsOfSymfony","followers_url":"https://api.github.com/users/FriendsOfSymfony/followers","following_url":"https://api.github.com/users/FriendsOfSymfony/following{/other_user}","gists_url":"https://api.github.com/users/FriendsOfSymfony/gists{/gist_id}","starred_url":"https://api.github.com/users/FriendsOfSymfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FriendsOfSymfony/subscriptions","organizations_url":"https://api.github.com/users/FriendsOfSymfony/orgs","repos_url":"https://api.github.com/users/FriendsOfSymfony/repos","events_url":"https://api.github.com/users/FriendsOfSymfony/events{/privacy}","received_events_url":"https://api.github.com/users/FriendsOfSymfony/received_events","type":"Organization","site_admin":false},"repo":{"id":16147914,"name":"FOSHttpCache","full_name":"FriendsOfSymfony/FOSHttpCache","owner":{"login":"FriendsOfSymfony","id":529709,"avatar_url":"https://avatars.githubusercontent.com/u/529709?v=3","gravatar_id":"","url":"https://api.github.com/users/FriendsOfSymfony","html_url":"https://github.com/FriendsOfSymfony","followers_url":"https://api.github.com/users/FriendsOfSymfony/followers","following_url":"https://api.github.com/users/FriendsOfSymfony/following{/other_user}","gists_url":"https://api.github.com/users/FriendsOfSymfony/gists{/gist_id}","starred_url":"https://api.github.com/users/FriendsOfSymfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FriendsOfSymfony/subscriptions","organizations_url":"https://api.github.com/users/FriendsOfSymfony/orgs","repos_url":"https://api.github.com/users/FriendsOfSymfony/repos","events_url":"https://api.github.com/users/FriendsOfSymfony/events{/privacy}","received_events_url":"https://api.github.com/users/FriendsOfSymfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FriendsOfSymfony/FOSHttpCache","description":"Integrate your PHP application with your HTTP caching proxy","fork":false,"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache","forks_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/forks","keys_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/teams","hooks_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/hooks","issue_events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/events{/number}","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/events","assignees_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/assignees{/user}","branches_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/branches{/branch}","tags_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/tags","blobs_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/git/refs{/sha}","trees_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/statuses/{sha}","languages_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/languages","stargazers_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/stargazers","contributors_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/contributors","subscribers_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/subscribers","subscription_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/subscription","commits_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/commits{/sha}","git_commits_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/git/commits{/sha}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/comments{/number}","issue_comment_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/comments/{number}","contents_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/contents/{+path}","compare_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/merges","archive_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/downloads","issues_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues{/number}","pulls_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls{/number}","milestones_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/milestones{/number}","notifications_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/labels{/name}","releases_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/releases{/id}","created_at":"2014-01-22T18:19:17Z","updated_at":"2015-01-30T20:32:46Z","pushed_at":"2015-01-22T07:04:18Z","git_url":"git://github.com/FriendsOfSymfony/FOSHttpCache.git","ssh_url":"git@github.com:FriendsOfSymfony/FOSHttpCache.git","clone_url":"https://github.com/FriendsOfSymfony/FOSHttpCache.git","svn_url":"https://github.com/FriendsOfSymfony/FOSHttpCache","homepage":"http://foshttpcache.readthedocs.org/","size":2532,"stargazers_count":88,"watchers_count":88,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":16,"forks":14,"open_issues":16,"watchers":88,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/167"},"html":{"href":"https://github.com/FriendsOfSymfony/FOSHttpCache/pull/167"},"issue":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/167"},"comments":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/issues/167/comments"},"review_comments":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/167/comments"},"review_comment":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/pulls/167/commits"},"statuses":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCache/statuses/61bcb77bf0dd901c9c119d93e7114cfa03171a81"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":23,"deletions":3,"changed_files":1}}