Skip to content

Commit

Permalink
fix: Do not fail when OIDC server application URL has a trailing slash
Browse files Browse the repository at this point in the history
Use `authlib` util `get_well_known_url` to get the well-known URL for
the OIDC server metadata. This will ensure that the URL is correctly
formatted and does not fail when the OIDC server application URL has a
trailing slash.

Fixes #1430.
  • Loading branch information
adamantike committed Jan 8, 2025
1 parent 4ab6fe6 commit 47fb3bd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/decorators/auth.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Any

from authlib.integrations.starlette_client import OAuth
from authlib.oidc.discovery import get_well_known_url
from config import (
OIDC_CLIENT_ID,
OIDC_CLIENT_SECRET,
Expand Down Expand Up @@ -49,7 +50,9 @@
name="openid",
client_id=config.get("OIDC_CLIENT_ID"),
client_secret=config.get("OIDC_CLIENT_SECRET"),
server_metadata_url=f'{config.get("OIDC_SERVER_APPLICATION_URL")}/.well-known/openid-configuration',
server_metadata_url=get_well_known_url(
config.get("OIDC_SERVER_APPLICATION_URL"), external=True
),
client_kwargs={"scope": "openid profile email"},
)

Expand Down

0 comments on commit 47fb3bd

Please sign in to comment.