HomeSoftware Heritage

django: Add OIDC Bearer Token authentication backend for DRF views

This commit no longer exists in the repository. It may have been part of a branch which was deleted.

Description

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

Commit No Longer Exists

This commit no longer exists in the repository.