Skip to content
Snippets Groups Projects
Commit 0c8c3ce7 authored by Antoine Lambert's avatar Antoine Lambert
Browse files

django: Add OIDC Bearer Token authentication backend for DRF views

Add a generic Django REST Framework authentication backend enabling to
authenticate a user using Keycloak and OpenID Connect bearer tokens.

The backend can be easily plugged into a DRF application by:

  * adding "swh.auth.django.backends.OIDCBearerTokenAuthentication"
    to the REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"]
    django setting.

  * configuring Keycloak URL, realm and client by adding
    SWH_AUTH_SERVER_URL, SWH_AUTH_REALM_NAME and SWH_AUTH_CLIENT_ID
    in django settings

Users will then be able to perform authenticated Web API calls by
sending their refresh token in HTTP Authorization headers.

Related to T3150
parent 367ead11
No related branches found
Tags swh-loader-bzr-20240216.1
1 merge request!19django: Add OIDC Bearer Token authentication backend for DRF views
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment