Remove the current authenticated user in the request which is invalid but only if the user is authenticated via the RemoteUserBackend.
(self, request)
| 262 | auth.logout(request) |
| 263 | |
| 264 | async def _aremove_invalid_user(self, request): |
| 265 | """ |
| 266 | Remove the current authenticated user in the request which is invalid |
| 267 | but only if the user is authenticated via the RemoteUserBackend. |
| 268 | """ |
| 269 | try: |
| 270 | stored_backend = load_backend( |
| 271 | await request.session.aget(auth.BACKEND_SESSION_KEY, "") |
| 272 | ) |
| 273 | except ImportError: |
| 274 | # Backend failed to load. |
| 275 | await auth.alogout(request) |
| 276 | else: |
| 277 | if isinstance(stored_backend, RemoteUserBackend): |
| 278 | await auth.alogout(request) |
| 279 | |
| 280 | |
| 281 | class PersistentRemoteUserMiddleware(RemoteUserMiddleware): |
no test coverage detected