-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security/Core] Add CustomUserMessageAccountStatusException #36656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
826df35
to
9233efb
Compare
Code looks good to me, but I am wondering what this is needed for and if this is the correct way of doing it? There are a few exceptions that already extend the AccountStatusException, e.g. LockedException, AccountExpiredException or DisabledException. These would not benefit from your change. Is that intended? That brings me to my other question, these Exceptions already communicate what the status problem was and a custom message could be provided, e.g. via translations. Do you have a use case for when you need a fully customizable message? Maybe that would help me understand better what this is needed for. |
Yes, it's intended. In the same way, there are multiple For You can indeed override the error message Plus, If you override an error message like |
Thanks for the clarification. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense, given AccountStatusException
s are handled differently by the Security system (see e.g. authentication provider manager and exception listener)
} | ||
|
||
/** | ||
* Set a message that will be shown to the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sets
Thank you @VincentLanglet. |
When implementing the
UserCheckerInterface
, we can throwAccountStatusException
. Similar toCustomUserMessageAuthenticationException
, this exception allow to throw anAccountStatusException
with a custom message.