forked from locustio/locust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2779fc
commit 2b8fd11
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.. _authentication: | ||
|
||
========================= | ||
Setting up Authentication | ||
========================= | ||
|
||
Locust uses `Flask-Login <https://pypi.org/project/Flask-Login/>`_ to handle authentication. The ``login_manager`` is exposed on ``environment.web_ui.app``, allowing the flexibility for you to implement any kind of auth that you would like! | ||
|
||
To use username / password authentication, simply provide a ``usernamePasswordCallback`` to the ``environment.web_ui.auth_args``. You are responsible for defining the route for the callback and implementing the authentication. | ||
|
||
Authentication providers can additionally be configured to allow authentication from 3rd parties such as GitHub or an SSO. Simply provider a list of desired ``auth_providers``. You may specify the ``label`` and ``icon`` for display on the button. The ``callback_url`` will be the url that the button directs to. You will be responsible for defining the callback route as well as the authentication with the 3rd party. | ||
|
||
Whether you are using username / password authentication, an auth provider, or both, a ``user_loader`` needs to be proivded to the ``login_manager``. The ``user_loader`` should return ``None`` to deny authentication and return a User object when authentication to the app should be granted. | ||
|
||
A full example can be seen `in the auth example <https://github.com/locustio/locust/tree/master/examples/auth.py>`_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters