yet another msal Single-Sign-On module of streamlit applications also for ConfidentialClientApplication by checking required App roles of signed-in users in the enterprise setup
Project description
Streamlit-MSAL-2: Yet Another MSAL for Streamlit
This is a workaround of streamlit to use msal authentication process in an enterprise environment for ConfidentialClientApplication.
How to install and use
- run pip install
pip install streamlit-msal-2
- integrate the package in your streamlit code
import streamlit as st
from streamlit_msal_2 import init_auth
st.title("Streamlit MSAL Example")
client_id = "your_client_id"
tenant_id = "your_tenant_id"
user_roles = {
"ExampleApp.Admin": "ExampleApp.Admin",
"ExampleApp.User": "ExampleApp.User",
}
init_auth(user_roles, tenant_id, client_id)
st.write(f"Welcome, {st.session_state.username}")
The user sign information is stored in st.session_state.auth_data
, the user name is stored in st.session_state.username
, and the user roles are stored in st.session_state.roles
.
How it works?
- this package is using streamlit-msal in the background for the authentication.
- however, streamlit-msal does not specially integrate msal ConfidentialClientApplication, while this is usually mandatorily required by enterprise use cases
- to simplify enterprise use cases, this package adds some additional role checking after streamlit-msal sign in
- these required roles can be directly configured in the Microsoft Azure App registration.
- by assigning user roles in App registration enterprise configuration, the authentication process can automatically check the signed in user's App roles, if it fulfills the predefined user roles, users can go further in streamlit
More to see documentation site.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file streamlit_msal_2-0.1.0.tar.gz
.
File metadata
- Download URL: streamlit_msal_2-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d406f67a3b18a6a5b3f23304aad1f7ce99a443aaf0fc6e271d278365fef87850 |
|
MD5 | ccbea9d9b09816a2ace611aa72064426 |
|
BLAKE2b-256 | f5a613add45aa3bbf0e638722c85145bb6814b52f14384e45b324ecb6f30ff07 |
File details
Details for the file streamlit_msal_2-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: streamlit_msal_2-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4bceb0e6b2a10a3d878a4de4aa75c474bd138d1a5c28c6e69b32442b926cf6c |
|
MD5 | 30264d5c395887e9a489e926149ede85 |
|
BLAKE2b-256 | d9376bb0c9d54d95aceca9d63cd4daf12b5fc6bf7573d89cb1243a3b6f2ccc0c |