diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2015-09-28 09:00:41 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2015-09-28 09:00:41 +0200 |
commit | 8ba7579a2fe5b384f10c20427e08bade4baf980d (patch) | |
tree | 7bd1b832fe6c43c1d5d0fbc47759957a45f3cd4b /Http | |
parent | 9b36490e86af00e50a5124cbdb63e57450235afa (diff) | |
parent | 1a66cae1aaed170da367d81c9fdc1f83cf6c3018 (diff) | |
download | symfony-security-8ba7579a2fe5b384f10c20427e08bade4baf980d.zip symfony-security-8ba7579a2fe5b384f10c20427e08bade4baf980d.tar.gz symfony-security-8ba7579a2fe5b384f10c20427e08bade4baf980d.tar.bz2 |
feature #15882 Easier Custom Authentication errors (weaverryan)
This PR was merged into the 2.8 branch.
Discussion
----------
Easier Custom Authentication errors
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | not yet
This makes failing authentication with a custom message much easier:
```php
throw CustomAuthenticationException::createWithSafeMessage(
'That was a ridiculous username'
);
// or
$e = new CustomAuthenticationException();
$e->setSafeMessage('That was a ridiculous username');
throw $e;
```
Currently, 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.
Thanks!
Commits
-------
d7c1463 Adding a class to make it easier to set custom authentication error messages
Diffstat (limited to 'Http')
0 files changed, 0 insertions, 0 deletions