django_socio_grpc.middlewares

https://docs.djangoproject.com/fr/4.1/topics/http/middleware For now only the call method of a middleware is supported

To use async middlewares, you need to use the correct decorator Here we use the sync_and_async_middleware decorators to declare these middlewares as sync and async compatible

Module Contents

Functions

_close_old_connections

close_old_connections_middleware

_log_requests

log_requests_middleware

locale_middleware

auth_without_session_middleware

This middleware is here to replace Django default Authentication Middleware as it look for the user session created by the login django method. This middleware is to use when using other Authenifciation pattern such as Token one.

Data

logger

API

django_socio_grpc.middlewares.logger

None

django_socio_grpc.middlewares._close_old_connections()
django_socio_grpc.middlewares.close_old_connections_middleware(get_response: Callable)
django_socio_grpc.middlewares._log_requests(request: django_socio_grpc.services.servicer_proxy.GRPCRequestContainer)
django_socio_grpc.middlewares.log_requests_middleware(get_response: Callable)
django_socio_grpc.middlewares.locale_middleware(get_response: Callable)
django_socio_grpc.middlewares.auth_without_session_middleware(get_response: Callable)

This middleware is here to replace Django default Authentication Middleware as it look for the user session created by the login django method. This middleware is to use when using other Authenifciation pattern such as Token one.

This middleware call the perform_authentication of the service. It should be placed before any other middleware that need context.user. If this middleware is not installed the authentication will still perform but after the execution of all the middleware.