用户数据配置:config 字典模拟用户数据库,stauth.Hasher 用于生成加密密码。 登录功能:authenticator.login() 用于处理登录验证,根据返回值 authentication_status 判断用户登录状态。 Cookie:配置项中的 cookie 设置了 JWT 的有效期,并使用一个密钥来确保用户登录状态的持久性。 登出功能:用户成功登录后可以通过侧边栏中...
2. Streamlit-Authenticator安全身份验证组件 在Streamlit官方文档中,没有提供提供安全身份验证组件。目前,第三方streamlit-authenticator(https://github.com/mkhorasani/Streamlit-Authenticator)提供此组件。 2.1.Hashing密码加密 hashed_passwords = stauth.Hasher(passwords).generate() 2.2. 创建登录窗口组件 使用哈希密码...
用户登录 Streamlit-Authenticator:https://github.com/mkhorasani/Streamlit-Authenticator pypi:https://pypi.org/project/streamlit-authenticator/ 一个安全身份验证模块,用于验证 Streamlit 应用程序中的用户凭据。更多使用方法参看github import streamlit as st import streamlit_authenticator as stauth def login_success...
importyamlfromyaml.loaderimportSafeLoaderwithopen('../config.yaml')asfile:config=yaml.load(file,Loader=SafeLoader)# Pre-hashing all plain text passwords once# stauth.Hasher.hash_passwords(config['credentials'])authenticator=stauth.Authenticate(config['credentials'],config['cookie']['name'],config['...
Hasher module moved to streamlit_authenticator.utilities 'preauthorized' key was changed to 'pre-authorized' in the config file and elsewhereAssets 2 Source code (zip) 2024-03-26T19:35:31Z Source code (tar.gz) 2024-03-26T19:35:31Z 🎉 2 2 people reacted Footer...
リスト等、イテラブルなオブジェクトである必要があるhashed_passwords=stauth.Hasher(passwords).generate()# cookie_expiry_daysでクッキーの有効期限を設定可能。認証情報の保持期間を設定でき値を0とするとアクセス毎に認証を要求するauthenticator=stauth.Authenticate(names,usernames,hashed_passwords,'some_...
load(file, Loader=SafeLoader) # Pre-hashing all plain text passwords once # stauth.Hasher.hash_passwords(config['credentials']) authenticator = stauth.Authenticate( config['credentials'], config['cookie']['name'], config['cookie']['key'], config['cookie']['expiry_days'] )...
Hasher(passwords).generate() authenticator = stauth.Authenticate(names, usernames, hashed_passwords, 'some_cookie_name', 'some_signature_key', cookie_expiry_days=1) name, authentication_status, username = authenticator.login('Login', 'main') if authentication_status: authenticator.logout('Logout'...
importyamlfromyaml.loaderimportSafeLoaderwithopen('../config.yaml')asfile:config=yaml.load(file,Loader=SafeLoader)# Pre-hashing all plain text passwords once# stauth.Hasher.hash_passwords(config['credentials'])authenticator=stauth.Authenticate(config['credentials'],config['cookie']['name'],config['...