lino.core.auth.middleware

(This module's source code is available here.)

Functions

get_user(request)

request2data(request[, user_language])

Classes

AuthenticationMiddleware([get_response])

DeviceTypeMiddleware([get_response])

Sets the device_type attribute on every incoming request.

NoUserMiddleware([get_response])

RemoteUserMiddleware([get_response])

Middleware for utilizing Web-server-provided authentication.

WithUserMiddleware([get_response])

class lino.core.auth.middleware.RemoteUserMiddleware(get_response=None)

Bases: django.utils.deprecation.MiddlewareMixin

Middleware for utilizing Web-server-provided authentication.

If request.user is not authenticated, then this middleware attempts to authenticate the username passed in the REMOTE_USER request header. If authentication is successful, the user is automatically logged in to persist the user in the session.

The header used is configurable and defaults to REMOTE_USER. Subclass this class and change the header attribute if you need to use a different header.

clean_username(username, request)

Allows the backend to clean the username, if the backend defines a clean_username method.

class lino.core.auth.middleware.DeviceTypeMiddleware(get_response=None)

Bases: django.utils.deprecation.MiddlewareMixin

Sets the device_type attribute on every incoming request.