MSAL Auth with Panel

I’m new to Panel, It’s Amazing.
Coming from Streamlit, I was using Azure MSAL auth to authenticate the Streamlit app with a streamlit-msal Module.
I will be amazed, if we can do the same thing in panel. Like in our org. We are using SSO, like on app start user landed on the Auth page and after authentication landed back to the app.
for reference:

import streamlit as st
from streamlit_msal import Msal
import logging
import os
import configparser
from app import main

CLIENT_ID = CLIENT_ID
AUTHORITY = f’https://login.microsoftonline.com/{TENANT_ID}
SCOPES = [“User.Read”]

Configure logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(name)

def load_config():
config = configparser.ConfigParser()
config_path = os.path.join(os.path.dirname(file), ‘config.ini’)
config.read(config_path)
return config

config = load_config()

def authentication():

# Initialize session state for MSAL initialization
if 'msal_initialized' not in st.session_state:
    st.session_state['msal_initialized'] = False

# Initialize session state for authentication data
if 'auth_data' not in st.session_state:
    st.session_state['auth_data'] = None

# Only initialize MSAL once when the app starts, avoid initialization during rerun
if not st.session_state['msal_initialized'] and st.session_state['auth_data'] is None:
    try:
        # Initialize MSAL and store auth data
        with st.sidebar:
            auth_data = Msal.initialize_ui(
            client_id=CLIENT_ID,
            authority=AUTHORITY,
            scopes=SCOPES,
            connecting_label="Connecting",
            disconnected_label="Disconnected",
            sign_in_label="Sign in",
            sign_out_label="Sign out")
        auth_data = {'account':{'name':'Harpreet Singh'}} 
        if auth_data:
            st.session_state['auth_data'] = auth_data
            st.session_state['msal_initialized'] = True
    except Exception as e:
        # Handle RerunData error by silently retrying the operation
        if "RerunData" in str(e):
            logger.warning(f"Rerun triggered during MSAL initialization: {e}")
            #st.rerun()  # Force rerun to simulate a second click
        else:
            logger.error(f"Error during MSAL initialization: {e}")
            st.stop()  # Stop app execution for other exceptions

# If authentication is successful, proceed with the app
if st.session_state['auth_data']:
    auth_data = st.session_state['auth_data']
    with st.sidebar:
        st.success(f"Hello {auth_data['account']['name']} ! You are authenticated.")
    #remove st.session_state.auth_data
    st.session_state['auth_data'] = None
    st.session_state['msal_initialized'] = False

    # start app logic here
    main()
else:
    st.error("You need to log in to use this app.")
    logger.info("You need to log in to use this app.")

if name == ‘main’:
authentication()

anyone, please help how we can do like this with panel.