{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/40289235","id":40289235,"diff_hunk":"@@ -0,0 +1,92 @@\n+<?php\n+\n+/*\n+ * This file is part of the Symfony package.\n+ *\n+ * (c) Fabien Potencier <fabien@symfony.com>\n+ *\n+ * For the full copyright and license information, please view the LICENSE\n+ * file that was distributed with this source code.\n+ */\n+\n+namespace Symfony\\Component\\Security\\Core\\Exception;\n+\n+/**\n+ * An authentication exception where you can add a message that will\n+ * be shown to the user, without needing to create a sub-class.\n+ *\n+ *  throw CustomAuthenticationException::createWithSafeMessage(\n+ *      'That was a ridiculous username'\n+ *  );\n+ *\n+ * @author Ryan Weaver <ryan@knpuniversity.com>\n+ */\n+class CustomAuthenticationException extends AuthenticationException","path":"src/Symfony/Component/Security/Core/Exception/CustomAuthenticationException.php","position":24,"original_position":24,"commit_id":"1773c0160113ccf6c68cd7c3253b3a3c8f9e14ab","original_commit_id":"1773c0160113ccf6c68cd7c3253b3a3c8f9e14ab","user":{"login":"fabpot","id":47313,"avatar_url":"https://avatars.githubusercontent.com/u/47313?v=3","gravatar_id":"","url":"https://api.github.com/users/fabpot","html_url":"https://github.com/fabpot","followers_url":"https://api.github.com/users/fabpot/followers","following_url":"https://api.github.com/users/fabpot/following{/other_user}","gists_url":"https://api.github.com/users/fabpot/gists{/gist_id}","starred_url":"https://api.github.com/users/fabpot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabpot/subscriptions","organizations_url":"https://api.github.com/users/fabpot/orgs","repos_url":"https://api.github.com/users/fabpot/repos","events_url":"https://api.github.com/users/fabpot/events{/privacy}","received_events_url":"https://api.github.com/users/fabpot/received_events","type":"User","site_admin":false},"body":"I would convey the \"safe\" (not sure if safe is the right word here) notion in the class name.","created_at":"2015-09-24T06:35:49Z","updated_at":"2015-09-24T06:35:49Z","html_url":"https://github.com/symfony/symfony/pull/15882#discussion_r40289235","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/15882","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/40289235"},"html":{"href":"https://github.com/symfony/symfony/pull/15882#discussion_r40289235"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/15882"}}},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/15882","id":45852960,"html_url":"https://github.com/symfony/symfony/pull/15882","diff_url":"https://github.com/symfony/symfony/pull/15882.diff","patch_url":"https://github.com/symfony/symfony/pull/15882.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/15882","number":15882,"state":"open","locked":false,"title":"Easier Custom Authentication errors","user":{"login":"weaverryan","id":121003,"avatar_url":"https://avatars.githubusercontent.com/u/121003?v=3","gravatar_id":"","url":"https://api.github.com/users/weaverryan","html_url":"https://github.com/weaverryan","followers_url":"https://api.github.com/users/weaverryan/followers","following_url":"https://api.github.com/users/weaverryan/following{/other_user}","gists_url":"https://api.github.com/users/weaverryan/gists{/gist_id}","starred_url":"https://api.github.com/users/weaverryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaverryan/subscriptions","organizations_url":"https://api.github.com/users/weaverryan/orgs","repos_url":"https://api.github.com/users/weaverryan/repos","events_url":"https://api.github.com/users/weaverryan/events{/privacy}","received_events_url":"https://api.github.com/users/weaverryan/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Bug fix?      | no\r\n| New feature?  | yes\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Tests pass?   | yes\r\n| Fixed tickets | n/a\r\n| License       | MIT\r\n| Doc PR        | not yet\r\n\r\nThis makes failing authentication with a custom message much easier:\r\n\r\n```php\r\nthrow CustomAuthenticationException::createWithSafeMessage(\r\n    'That was a ridiculous username'\r\n);\r\n\r\n// or\r\n$e = new CustomAuthenticationException();\r\n$e->setSafeMessage('That was a ridiculous username');\r\n\r\nthrow $e;\r\n```\r\n\r\nCurrently, to do this, you'd need to create a new sub-class of `AuthenticationException`, which is way more work than it needs to be. The original design was so that all messages exposed are safe, which is why I've named the methods like I have.\r\n\r\nThanks!","created_at":"2015-09-24T02:19:36Z","updated_at":"2015-09-24T06:35:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f62932786c668362ef04ef2b5aa772e30b9076e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/15882/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/15882/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/15882/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/1773c0160113ccf6c68cd7c3253b3a3c8f9e14ab","head":{"label":"weaverryan:custom-authentication-exception","ref":"custom-authentication-exception","sha":"1773c0160113ccf6c68cd7c3253b3a3c8f9e14ab","user":{"login":"weaverryan","id":121003,"avatar_url":"https://avatars.githubusercontent.com/u/121003?v=3","gravatar_id":"","url":"https://api.github.com/users/weaverryan","html_url":"https://github.com/weaverryan","followers_url":"https://api.github.com/users/weaverryan/followers","following_url":"https://api.github.com/users/weaverryan/following{/other_user}","gists_url":"https://api.github.com/users/weaverryan/gists{/gist_id}","starred_url":"https://api.github.com/users/weaverryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaverryan/subscriptions","organizations_url":"https://api.github.com/users/weaverryan/orgs","repos_url":"https://api.github.com/users/weaverryan/repos","events_url":"https://api.github.com/users/weaverryan/events{/privacy}","received_events_url":"https://api.github.com/users/weaverryan/received_events","type":"User","site_admin":false},"repo":{"id":21151556,"name":"symfony","full_name":"weaverryan/symfony","owner":{"login":"weaverryan","id":121003,"avatar_url":"https://avatars.githubusercontent.com/u/121003?v=3","gravatar_id":"","url":"https://api.github.com/users/weaverryan","html_url":"https://github.com/weaverryan","followers_url":"https://api.github.com/users/weaverryan/followers","following_url":"https://api.github.com/users/weaverryan/following{/other_user}","gists_url":"https://api.github.com/users/weaverryan/gists{/gist_id}","starred_url":"https://api.github.com/users/weaverryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaverryan/subscriptions","organizations_url":"https://api.github.com/users/weaverryan/orgs","repos_url":"https://api.github.com/users/weaverryan/repos","events_url":"https://api.github.com/users/weaverryan/events{/privacy}","received_events_url":"https://api.github.com/users/weaverryan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/weaverryan/symfony","description":"The Symfony PHP framework","fork":true,"url":"https://api.github.com/repos/weaverryan/symfony","forks_url":"https://api.github.com/repos/weaverryan/symfony/forks","keys_url":"https://api.github.com/repos/weaverryan/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/weaverryan/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/weaverryan/symfony/teams","hooks_url":"https://api.github.com/repos/weaverryan/symfony/hooks","issue_events_url":"https://api.github.com/repos/weaverryan/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/weaverryan/symfony/events","assignees_url":"https://api.github.com/repos/weaverryan/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/weaverryan/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/weaverryan/symfony/tags","blobs_url":"https://api.github.com/repos/weaverryan/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/weaverryan/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/weaverryan/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/weaverryan/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/weaverryan/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/weaverryan/symfony/languages","stargazers_url":"https://api.github.com/repos/weaverryan/symfony/stargazers","contributors_url":"https://api.github.com/repos/weaverryan/symfony/contributors","subscribers_url":"https://api.github.com/repos/weaverryan/symfony/subscribers","subscription_url":"https://api.github.com/repos/weaverryan/symfony/subscription","commits_url":"https://api.github.com/repos/weaverryan/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/weaverryan/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/weaverryan/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/weaverryan/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/weaverryan/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/weaverryan/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/weaverryan/symfony/merges","archive_url":"https://api.github.com/repos/weaverryan/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/weaverryan/symfony/downloads","issues_url":"https://api.github.com/repos/weaverryan/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/weaverryan/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/weaverryan/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/weaverryan/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/weaverryan/symfony/labels{/name}","releases_url":"https://api.github.com/repos/weaverryan/symfony/releases{/id}","created_at":"2014-06-24T04:00:07Z","updated_at":"2015-06-28T12:37:42Z","pushed_at":"2015-09-24T02:42:37Z","git_url":"git://github.com/weaverryan/symfony.git","ssh_url":"git@github.com:weaverryan/symfony.git","clone_url":"https://github.com/weaverryan/symfony.git","svn_url":"https://github.com/weaverryan/symfony","homepage":"symfony.com","size":60594,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"symfony:2.8","ref":"2.8","sha":"d1ae400cb1cafa793038b520f9bef9531109583c","user":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"repo":{"id":458058,"name":"symfony","full_name":"symfony/symfony","owner":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/symfony/symfony","description":"The Symfony PHP framework","fork":false,"url":"https://api.github.com/repos/symfony/symfony","forks_url":"https://api.github.com/repos/symfony/symfony/forks","keys_url":"https://api.github.com/repos/symfony/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/symfony/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/symfony/symfony/teams","hooks_url":"https://api.github.com/repos/symfony/symfony/hooks","issue_events_url":"https://api.github.com/repos/symfony/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/symfony/symfony/events","assignees_url":"https://api.github.com/repos/symfony/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/symfony/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/symfony/symfony/tags","blobs_url":"https://api.github.com/repos/symfony/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/symfony/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/symfony/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/symfony/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/symfony/symfony/languages","stargazers_url":"https://api.github.com/repos/symfony/symfony/stargazers","contributors_url":"https://api.github.com/repos/symfony/symfony/contributors","subscribers_url":"https://api.github.com/repos/symfony/symfony/subscribers","subscription_url":"https://api.github.com/repos/symfony/symfony/subscription","commits_url":"https://api.github.com/repos/symfony/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/symfony/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/symfony/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/symfony/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/symfony/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/symfony/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/symfony/symfony/merges","archive_url":"https://api.github.com/repos/symfony/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/symfony/symfony/downloads","issues_url":"https://api.github.com/repos/symfony/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/symfony/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/symfony/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/symfony/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/symfony/symfony/labels{/name}","releases_url":"https://api.github.com/repos/symfony/symfony/releases{/id}","created_at":"2010-01-04T14:21:21Z","updated_at":"2015-09-24T01:53:11Z","pushed_at":"2015-09-24T06:34:11Z","git_url":"git://github.com/symfony/symfony.git","ssh_url":"git@github.com:symfony/symfony.git","clone_url":"https://github.com/symfony/symfony.git","svn_url":"https://github.com/symfony/symfony","homepage":"symfony.com","size":248370,"stargazers_count":10823,"watchers_count":10823,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":4268,"mirror_url":null,"open_issues_count":937,"forks":4268,"open_issues":937,"watchers":10823,"default_branch":"2.8"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/15882"},"html":{"href":"https://github.com/symfony/symfony/pull/15882"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/15882"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/15882/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/15882/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/15882/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/1773c0160113ccf6c68cd7c3253b3a3c8f9e14ab"}}}}