From 17f14dec82db07b6ae7eabd1c060d9d885516eda Mon Sep 17 00:00:00 2001 From: Johan Lundberg Date: Fri, 20 Oct 2023 15:18:09 +0200 Subject: [PATCH] add CORSMiddleware --- src/auth_server/api.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/auth_server/api.py b/src/auth_server/api.py index eb182f7..8dc1594 100644 --- a/src/auth_server/api.py +++ b/src/auth_server/api.py @@ -3,6 +3,7 @@ from typing import Dict, Type, cast from fastapi import FastAPI +from fastapi.middleware.cors import CORSMiddleware from starlette.staticfiles import StaticFiles from auth_server.config import AuthServerConfig, ConfigurationError, FlowName, load_config @@ -65,6 +66,13 @@ def init_auth_server_api() -> AuthServer: app = AuthServer() app.router.route_class = ContextRequestRoute app.add_middleware(JOSEMiddleware) + app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], + ) app.include_router(root_router) app.include_router(interaction_router) app.include_router(saml2_router)