-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·49 lines (38 loc) · 1.43 KB
/
main.py
File metadata and controls
executable file
·49 lines (38 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
Main FastAPI application with SAML authentication
"""
import os
import pdb
import uvicorn
from fastapi import FastAPI
from starlette.middleware.sessions import SessionMiddleware
from fastapi.staticfiles import StaticFiles
from config import SESSION_SECRET_KEY
from routers import saml, protected, public
from dotenv import load_dotenv
load_dotenv()
root_path = os.getenv("root_path")
app = FastAPI(title="FastAPI SAML SSO Demo", root_path=root_path)
app.add_middleware(SessionMiddleware,
secret_key=SESSION_SECRET_KEY,
same_site="lax",
https_only=False)
app.mount("/static", StaticFiles(directory="static"), name="static")
# Include routers
app.include_router(saml.router)
app.include_router(protected.router)
app.include_router(public.router)
if __name__ == "__main__":
print("\n" + "="*60)
print("FastAPI SAML SSO Server Starting...")
print("="*60)
print("\n📋 Setup Checklist:")
print(" 1. Update SAML_SETTINGS with your Okta configuration")
print(" 2. In Okta, set Single sign-on URL to:")
print(" → http://localhost:8000/saml/acs")
print(" 3. In Okta, set Audience URI to:")
print(" → http://localhost:8000/saml/metadata")
print("\n🌐 Server running at: http://localhost:8000")
print(" View metadata at: http://localhost:8000/saml/metadata")
print("="*60 + "\n")
uvicorn.run(app, host="0.0.0.0", port=8000)