mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-28 02:10:38 +02:00
Add auth_route parameter to SupabaseProvider (#2760)
Co-authored-by: Eloi Zalczer <eloi@entropia.io>
This commit is contained in:
parent
4963b516c2
commit
6bade1cbd9
3 changed files with 42 additions and 8 deletions
|
|
@ -40,12 +40,14 @@ class TestSupabaseProvider:
|
|||
{
|
||||
"FASTMCP_SERVER_AUTH_SUPABASE_PROJECT_URL": "https://env123.supabase.co",
|
||||
"FASTMCP_SERVER_AUTH_SUPABASE_BASE_URL": "https://envserver.com",
|
||||
"FASTMCP_SERVER_AUTH_SUPABASE_AUTH_ROUTE": "/custom/auth/route",
|
||||
},
|
||||
):
|
||||
provider = SupabaseProvider()
|
||||
|
||||
assert provider.project_url == "https://env123.supabase.co"
|
||||
assert str(provider.base_url) == "https://envserver.com/"
|
||||
assert provider.auth_route == "custom/auth/route"
|
||||
|
||||
def test_environment_variable_loading(self):
|
||||
"""Test that environment variables are loaded correctly."""
|
||||
|
|
@ -150,6 +152,28 @@ class TestSupabaseProvider:
|
|||
|
||||
assert provider.token_verifier.algorithm == "RS256" # type: ignore[attr-defined]
|
||||
|
||||
def test_custom_auth_route(self):
|
||||
provider = SupabaseProvider(
|
||||
project_url="https://abc123.supabase.co",
|
||||
base_url="https://myserver.com",
|
||||
auth_route="/custom/auth/route",
|
||||
)
|
||||
|
||||
assert provider.auth_route == "custom/auth/route"
|
||||
assert (
|
||||
provider.token_verifier.jwks_uri
|
||||
== "https://abc123.supabase.co/custom/auth/route/.well-known/jwks.json"
|
||||
) # type: ignore[attr-defined]
|
||||
|
||||
def test_custom_auth_route_trailing_slash(self):
|
||||
provider = SupabaseProvider(
|
||||
project_url="https://abc123.supabase.co",
|
||||
base_url="https://myserver.com",
|
||||
auth_route="/custom/auth/route/",
|
||||
)
|
||||
|
||||
assert provider.auth_route == "custom/auth/route"
|
||||
|
||||
|
||||
def run_mcp_server(host: str, port: int) -> None:
|
||||
mcp = FastMCP(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue