mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 21:44:18 +02:00
feat:fixed coderabbit comments
This commit is contained in:
parent
e2d424e1d6
commit
69f77d4d2c
3 changed files with 9 additions and 9 deletions
|
|
@ -37,7 +37,7 @@ from fastmcp.server.auth.providers.supabase import SupabaseProvider
|
|||
# Configure Supabase Auth
|
||||
auth = SupabaseProvider(
|
||||
project_url="https://abc123.supabase.co",
|
||||
base_url="http://localhost:8000"
|
||||
base_url="http://localhost:8000",
|
||||
auth_route="/my/auth/route" # if self-hosting and using custom routes
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -128,13 +128,13 @@ class SupabaseProvider(RemoteAuthProvider):
|
|||
|
||||
self.project_url = str(settings.project_url).rstrip("/")
|
||||
self.base_url = AnyHttpUrl(str(settings.base_url).rstrip("/"))
|
||||
self.auth_route = settings.auth_route.rstrip("/")
|
||||
self.auth_route = settings.auth_route.strip("/")
|
||||
|
||||
# Create default JWT verifier if none provided
|
||||
if token_verifier is None:
|
||||
token_verifier = JWTVerifier(
|
||||
jwks_uri=f"{self.project_url}{self.auth_route}/.well-known/jwks.json",
|
||||
issuer=f"{self.project_url}{self.auth_route}",
|
||||
jwks_uri=f"{self.project_url}/{self.auth_route}/.well-known/jwks.json",
|
||||
issuer=f"{self.project_url}/{self.auth_route}",
|
||||
algorithm=settings.algorithm,
|
||||
required_scopes=settings.required_scopes,
|
||||
)
|
||||
|
|
@ -142,7 +142,7 @@ class SupabaseProvider(RemoteAuthProvider):
|
|||
# Initialize RemoteAuthProvider with Supabase as the authorization server
|
||||
super().__init__(
|
||||
token_verifier=token_verifier,
|
||||
authorization_servers=[AnyHttpUrl(f"{self.project_url}{self.auth_route}")],
|
||||
authorization_servers=[AnyHttpUrl(f"{self.project_url}/{self.auth_route}")],
|
||||
base_url=self.base_url,
|
||||
)
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ class SupabaseProvider(RemoteAuthProvider):
|
|||
try:
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.get(
|
||||
f"{self.project_url}{self.auth_route}/.well-known/oauth-authorization-server"
|
||||
f"{self.project_url}/{self.auth_route}/.well-known/oauth-authorization-server"
|
||||
)
|
||||
response.raise_for_status()
|
||||
metadata = response.json()
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class TestSupabaseProvider:
|
|||
|
||||
assert provider.project_url == "https://env123.supabase.co"
|
||||
assert str(provider.base_url) == "https://envserver.com/"
|
||||
assert provider.auth_route == "/custom/auth/route"
|
||||
assert provider.auth_route == "custom/auth/route"
|
||||
|
||||
def test_environment_variable_loading(self):
|
||||
"""Test that environment variables are loaded correctly."""
|
||||
|
|
@ -159,7 +159,7 @@ class TestSupabaseProvider:
|
|||
auth_route="/custom/auth/route",
|
||||
)
|
||||
|
||||
assert provider.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"
|
||||
|
|
@ -172,7 +172,7 @@ class TestSupabaseProvider:
|
|||
auth_route="/custom/auth/route/",
|
||||
)
|
||||
|
||||
assert provider.auth_route == "/custom/auth/route"
|
||||
assert provider.auth_route == "custom/auth/route"
|
||||
|
||||
|
||||
def run_mcp_server(host: str, port: int) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue