-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
[Security] Custom Authenticator: What does "validate no parameter is empty" mean? #19812
Comments
Hi! I agree with (3), this seems an irrelevant to mention in this particular example. Let's remove the text and leave just As for your other 2 questions: I would say it's good to validate user input related to authentication explicitly if it confirms the rules of your application, rather than relying on "implementation details" of the Symfony framework. Throwing an authentication exception is the best solution, this will give the validation the same handling as other authentication error messages like "bad credentials" (i.e. call the |
Sorry, I wasn't aware that an exception in this context isn't really thrown, but caught by the next method. So raising an exception is indeed the way to go! So I think this code snippet should be expanded to something like: if ('' === $username || '' === $password) {
throw new WhateverException();
} But where to put it? So in case you're already losing overview of what I have in mind ;-) |
@wouterj You were the last one who edited the code block at https://symfony.com/doc/current/security/custom_authenticator.html#passport-badges in this commit: 01cb2b0
What does "validate no parameter is empty" mean there?
''
, I still need to return aPassport
. So (except from throwing an exception), there's nothing much I could do about it (especially can't generate a form error message), right?=> So I'd say either just delete it, or give a more complete idea of what to do:
The text was updated successfully, but these errors were encountered: