Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ROMM-540] OIDC Support #1321

Merged
merged 26 commits into from
Dec 18, 2024
Merged

[ROMM-540] OIDC Support #1321

merged 26 commits into from
Dec 18, 2024

Conversation

gantoine
Copy link
Member

@gantoine gantoine commented Nov 28, 2024

This PR adds support for authentication via an external OIDC server (Authentik, Authelia, etc). New OIDC_ env variables were added to connect to the OIDC provider. Hitting the endpoint /login/openid kicks off the OAuth flow, and the callback (with encrypted token) is handled by /oauth/openid.

The dev docker-compose.yml now includes entries for running an authentik server locally (for dev and testing). Setup in authentik requires creating an OAuth Provider, then an Application using that provider.

Closes #540

Copy link

github-actions bot commented Nov 28, 2024

Test Results

92 tests   92 ✅  27s ⏱️
 1 suites   0 💤
 1 files     0 ❌

Results for commit 37db255.

♻️ This comment has been updated with latest results.

@zurdi15 zurdi15 changed the title OIDC Support feat: OIDC Support Dec 2, 2024
request.session.clear()

return {"msg": "Successfully logged out"}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unchanged, just moved it up

@@ -102,7 +102,7 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
app.include_router(states.router, prefix="/api")
app.include_router(tasks.router, prefix="/api")
app.include_router(feeds.router, prefix="/api")
app.include_router(config.router, prefix="/api")
app.include_router(configs.router, prefix="/api")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to stop vscode complaining when getting confused between the backend/config and config/__init__

@@ -16,3 +16,4 @@ env =
SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON=0 4 * * *
UPLOAD_TIMEOUT=20
LOGLEVEL=DEBUG
OIDC_ENABLED=false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we set this for all tests so they run, but override it in OIDC handler tests

@gantoine gantoine changed the title feat: OIDC Support [ROMM-540] OIDC Support Dec 13, 2024
@gantoine gantoine marked this pull request as ready for review December 13, 2024 16:38
@zurdi15
Copy link
Member

zurdi15 commented Dec 17, 2024

Just added the new OIDC_ env variables to the development template

Copy link
Collaborator

@adamantike adamantike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great implementation! Just added a few small comments.

backend/config/__init__.py Outdated Show resolved Hide resolved
backend/handler/auth/base_handler.py Outdated Show resolved Hide resolved
@gantoine gantoine merged commit 651558c into master Dec 18, 2024
9 checks passed
@gantoine gantoine deleted the openid-connect branch December 18, 2024 16:15
@jvanbruegge
Copy link
Contributor

Nice, thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants