MCPcopy
hub / github.com/django/django / _remove_invalid_user

Method _remove_invalid_user

django/contrib/auth/middleware.py:248–262  ·  view source on GitHub ↗

Remove the current authenticated user in the request which is invalid but only if the user is authenticated via the RemoteUserBackend.

(self, request)

Source from the content-addressed store, hash-verified

246 return request.META[self.header]
247
248 def _remove_invalid_user(self, request):
249 """
250 Remove the current authenticated user in the request which is invalid
251 but only if the user is authenticated via the RemoteUserBackend.
252 """
253 try:
254 stored_backend = load_backend(
255 request.session.get(auth.BACKEND_SESSION_KEY, "")
256 )
257 except ImportError:
258 # backend failed to load
259 auth.logout(request)
260 else:
261 if isinstance(stored_backend, RemoteUserBackend):
262 auth.logout(request)
263
264 async def _aremove_invalid_user(self, request):
265 """

Callers 1

process_requestMethod · 0.95

Calls 3

load_backendFunction · 0.90
getMethod · 0.45
logoutMethod · 0.45

Tested by

no test coverage detected