-
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.
Add basic auth as new authentication option
- Loading branch information
1 parent
aaa589e
commit 1b5284f
Showing
4 changed files
with
18 additions
and
4 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
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
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
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 |
---|---|---|
|
@@ -6,7 +6,8 @@ | |
from fastagency.adapters.fastapi import FastAPIAdapter | ||
from fastagency.app import FastAgency | ||
from fastagency.ui.mesop import MesopUI{% if cookiecutter.authentication == "google" %} | ||
from fastagency.ui.mesop.auth.firebase import FirebaseAuth, FirebaseConfig{% endif %} | ||
from fastagency.ui.mesop.auth.firebase import FirebaseAuth, FirebaseConfig{% elif cookiecutter.authentication == "basic" %} | ||
from fastagency.ui.mesop.auth.basic_auth import BasicAuth{% endif %} | ||
|
||
fastapi_url = "http://localhost:8008" | ||
|
||
|
@@ -26,6 +27,19 @@ | |
allowed_users=allowed_users, | ||
) | ||
|
||
ui = MesopUI(auth=auth) | ||
{%- elif cookiecutter.authentication == "basic" %} | ||
auth = BasicAuth( | ||
# TODO: Replace `allowed_users` with the desired usernames and their | ||
# bcrypt-hashed passwords. One way to generate bcrypt-hashed passwords | ||
# is by using online tools such as https://bcrypt.online | ||
# Default password for all users is `password` | ||
allowed_users={ | ||
"admin": "$2y$10$ZgcGQlsvMoMRmmW4Y.nUVuVHc.vOJsOA7iXAPXWPFy9DX2S7oeTDa", # nosemgrep: generic.secrets.security.detected-bcrypt-hash.detected-bcrypt-hash | ||
"[email protected]": "$2y$10$ZgcGQlsvMoMRmmW4Y.nUVuVHc.vOJsOA7iXAPXWPFy9DX2S7oeTDa", # nosemgrep: generic.secrets.security.detected-bcrypt-hash.detected-bcrypt-hash | ||
}, | ||
) | ||
|
||
ui = MesopUI(auth=auth) | ||
{% else %} | ||
ui = MesopUI() | ||
|