Spaces:
Running
Running
Create auth.py
Browse files
auth.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import yaml
|
2 |
+
from yaml.loader import SafeLoader
|
3 |
+
import streamlit_authenticator as stauth
|
4 |
+
|
5 |
+
# Load config from YAML
|
6 |
+
with open('config.yaml') as file:
|
7 |
+
config = yaml.load(file, Loader=SafeLoader)
|
8 |
+
|
9 |
+
# Define the authenticator
|
10 |
+
authenticator = stauth.Authenticate(
|
11 |
+
config['credentials'], # contains usernames/passwords
|
12 |
+
config['cookie']['name'], # name of the login session cookie
|
13 |
+
config['cookie']['key'], # secret key for signing the cookie
|
14 |
+
config['cookie']['expiry_days'],
|
15 |
+
config['preauthorized'] # email whitelist
|
16 |
+
)
|