swh.deposit.auth module

swh.deposit.auth.convert_response(request, content)[source]

Convert response from drf’s basic authentication mechanism to a swh-deposit one.

Args:

request (Request): Use to build the response content (bytes): The drf’s answer

Returns:

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]

Bases: object

Middleware to capture potential authentication error and convert them to standard deposit response.

This is to be installed in django’s settings.py module.