- swh.deposit.auth.convert_response(request, content)[source]#
Convert response from drf’s basic authentication mechanism to a swh-deposit one.
request (Request): Use to build the response content (bytes): The drf’s answer
Response with the same status error as before, only the body is now an swh-deposit compliant one.
- class swh.deposit.auth.WrapBasicAuthenticationResponseMiddleware(get_response)[source]#
Middleware to capture potential authentication error and convert them to standard deposit response.
This is to be installed in django’s settings.py module.
- class swh.deposit.auth.HasDepositPermission[source]#
Allows access to authenticated users with the DEPOSIT_PERMISSION.
- class swh.deposit.auth.KeycloakBasicAuthentication[source]#
Keycloack authentication against username/password.
Deposit users will continue sending Basic authentication queries to the deposit server. Transparently, the deposit server will stop authenticate itself the users. It will delegate the authentication queries to the keycloak instance.
rest_framework.BasicAuthenticationand overrides the func:authenticate_credentials method to discuss with keycloak.
As an implementation detail, this also uses the django cache mechanism to avoid too many authentication request to keycloak.
- property client#