-
- Downloads
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
Showing
- requirements-django.txt 1 addition, 1 deletionrequirements-django.txt
- swh/auth/django/backends.py 90 additions, 1 deletionswh/auth/django/backends.py
- swh/auth/tests/conftest.py 13 additions, 0 deletionsswh/auth/tests/conftest.py
- swh/auth/tests/django/app/apptest/settings.py 8 additions, 0 deletionsswh/auth/tests/django/app/apptest/settings.py
- swh/auth/tests/django/app/apptest/urls.py 11 additions, 1 deletionswh/auth/tests/django/app/apptest/urls.py
- swh/auth/tests/django/test_backends.py 105 additions, 0 deletionsswh/auth/tests/django/test_backends.py
- swh/auth/tests/django/test_drf_bearer_token_auth.py 109 additions, 0 deletionsswh/auth/tests/django/test_drf_bearer_token_auth.py
Loading
-
Some references in the commit message have been migrated:
- T3150 is now swh-web#3150 (closed)
Please register or sign in to comment