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

✨(backend) support Authorization Code flow #5

Merged
merged 7 commits into from
Mar 3, 2024
Merged

✨(backend) support Authorization Code flow #5

merged 7 commits into from
Mar 3, 2024

Conversation

lebaudantoine
Copy link
Collaborator

Purpose

Preparing project for staging deployment by adding backend support for Authorization Code Flow in OIDC.

Proposal

  • Configure Keycloak server
  • Drop JWT authentication
  • Add new dependency mozzila-django-oidc
  • Fix production image

Create a realm 'impress' and configure it to support
the authorization code flow.
@lebaudantoine lebaudantoine self-assigned this Feb 26, 2024
Copy link

gitguardian bot commented Feb 26, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
6951547 Triggered Generic Password 1391400 docker/auth/realm.json View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Revoke and rotate the secret.

  2. If possible, rewrite git history with git commit --amend and git push --force.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

src/backend/publish/settings.py Outdated Show resolved Hide resolved
src/backend/core/authentication.py Outdated Show resolved Hide resolved
src/backend/core/authentication.py Show resolved Hide resolved
Integrate 'mozilla-django-oidc' dependency, to support
Authorization Code flow, which is required by Agent Connect.

Thus, we provide a secure back channel OIDC flow, and return
to the client only a session cookie.

Done:
- Replace JWT authentication by Session based authentication in DRF
- Update Django settings to make OIDC configurations easily editable
- Add 'mozilla-django-oidc' routes to our router
- Implement a custom Django Authentication class to adapt
'mozilla-django-oidc' to our needs

'mozilla-django-oidc' routes added are:
- /authenticate
- /callback (the redirect_uri called back by the Idp)
- /logout
Force login to bypass authorization checks when necessary.

Note: Generating a session cookie through OIDC flow
is not supported while testing our API.
Found typos and fixed them.
The local deployment of the Production image through docker-compose was
failing due to issues in the Django configurations, influenced by Joanie.

The bug stemmed from a dependency on a development-specific package
(drf-spectacular-sidecar) while attempting to run the application in
production mode.

Changes Made:
- Introduced new Django settings for local demo environments.
Add tests on get_or_create method.
Lint backend tests and sources.
@lebaudantoine lebaudantoine added the enhancement New feature or request label Mar 2, 2024
@sampaccoud sampaccoud merged commit a23118b into main Mar 3, 2024
6 of 10 checks passed
@AntoLC AntoLC deleted the al-sso branch August 7, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants