Skip to content

Commit

Permalink
Disable authentication for certs endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted committed Mar 5, 2024
1 parent 107d331 commit 0abd7c4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions keycloak_oauth/starlette_admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Sequence
from typing import Any, Sequence
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses import RedirectResponse
Expand Down Expand Up @@ -50,6 +50,10 @@ async def render_logout(
async def handle_auth_callback(self, request: Request) -> RedirectResponse:
return await self.keycloak.auth(request)

@login_not_required
async def public_keys(self) -> dict[str, Any]:
return await self.keycloak.public_keys()

def setup_admin(self, admin: BaseAdmin) -> None:
super().setup_admin(admin)
"""add custom authentication callback route"""
Expand All @@ -64,7 +68,7 @@ def setup_admin(self, admin: BaseAdmin) -> None:
admin.routes.append(
Route(
"/auth/certs",
self.keycloak.public_keys,
self.public_keys,
methods=["GET"],
)
)

0 comments on commit 0abd7c4

Please sign in to comment.