-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Web UI Modern Auth #2538
Web UI Modern Auth #2538
Conversation
4569b0d
to
f302982
Compare
Cool stuff. See comments. Can you have an extra look and ensure there are no remnants (documentation etc) of the old stuff? Pretty sure we can nuke the AuthCredentialsError class for example. |
3c9e288
to
0520dbf
Compare
Looking good! Only that one last comment about --web-auth :) |
47cb865
to
099ac03
Compare
Given that the package we use is called flask-login, perhaps it makes more sense to name the argument |
Yup that makes sense! What do you think about |
099ac03
to
09d11c5
Compare
locust/web.py
Outdated
def __init__( | ||
self, | ||
environment: "Environment", | ||
host: str, | ||
port: int, | ||
auth_credentials: Optional[str] = None, | ||
use_auth: bool = False, |
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.
rename this to web_login
? or maybe just login
...
locust/argument_parser.py
Outdated
@@ -355,9 +355,16 @@ def setup_parser_arguments(parser): | |||
dest="web_auth", | |||
metavar="<username:password>", | |||
default=None, | |||
help="DEPRECATED. See https://github.com/locustio/locust/issues/2517 Turn on Basic Auth for the web interface. Should be supplied in the following format: username:password ", | |||
help="DEPRECATED: use --web-login", |
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.
Change this to configargparse.SUPPRESS to hide it from the help text and let the error message speak for itself :)
I made two more comments :) And also... I have another thought. Maybe we dont even need a command line argument to enable it? Perhaps we can just check whether someone has registered a user_loader callback (by calling |
09d11c5
to
71e856e
Compare
Unfortunately I don't think there's a clean way to get around having an argument. The issue is that without the argument we need to initialize the |
I guess we could have the users set their |
I see! Sounds messy. Lets keep the parameter then. Ok to merge? |
Let's do it :) |
Never mind, it is fine, I just made a mistake when testing it :) |
Fixes #2517
Proposal
flask_basicauth
in favor offlask_login
. The proposal is to move the responsibility of security and maintainability onto the user. Locust will simply specify which routes need to be protected, but the user will be the one responsible for implementing the protection. This has the added benefit of providing flexibility as to how users authenticate to the app