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

[Demo] Add a simple oauth implementation via django-oauth-toolkit #447

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gkju
Copy link

@gkju gkju commented Dec 16, 2024

Adding barebones oauth support is pretty trivial when using django-oauth-toolkit and this commit demonstrates the MVP. In a debug environment as per the docs one can use /o/applications/ to register an oauth2 app with ex;

Client Type: confidential
Authorization Grant Type: Resource owner password-based

then retrieve an access token for admin (after replacing <client_id>, <client_secret> with the appropriate values) using curl;

curl -X POST -d "grant_type=password&username=admin&password=admin" -u"<client_id>:<client_secret>" http://localhost:8000/o/token/

and authenticate API calls via the access token (using the bearer scheme) which can be refreshed with the refresh token as in the spec. Other oauth2 flows work out of the box as well. In a production environment, I would implement special admin pages for managing the applications, and add config options for enabling oauth/defining clients. The toolkit package also adds some new migrations for the oauth-related models which have to be applied in current installations.

The things to consider are;

  • Using OIDC
  • What should be included in a default installation
  • What means of configuration would be preferred (defining clients statically in config files/managing them via a webui)

This pull request would be very useful for the upcoming TAG semester, in my opinion, as it greatly simplifies creating discrete applications that interconnect with oioioi installations.

@gkju gkju requested a review from twalen December 16, 2024 17:33
@gkju gkju linked an issue Dec 16, 2024 that may be closed by this pull request
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.

Alternative authentication methods for the http API
1 participant