Package wsgitools :: Module middlewares :: Class BasicAuthMiddleware
[hide private]
[frames] | no frames]

Class BasicAuthMiddleware

source code

Middleware implementing HTTP Basic Auth.

Instance Methods [hide private]
 
__init__(self, app, check_function, realm='www', app401=None) source code
 
__call__(self, environ, start_response)
wsgi interface
source code
 
authorization_required(self, environ, start_response)
wsgi application for indicating authorization is required.
source code
Method Details [hide private]

__init__(self, app, check_function, realm='www', app401=None)
(Constructor)

source code 
Parameters:
  • app - is a WSGI application.
  • check_function - is a function taking three arguments username, password and environment returning a bool indicating whether the request may is allowed. The older interface of taking only the first two arguments is still supported via catching a TypeError.
  • app401 - is an optional WSGI application to be used for error messages
  • realm (str)

__call__(self, environ, start_response)
(Call operator)

source code 

wsgi interface

Parameters:
  • environ ({str: str})

authorization_required(self, environ, start_response)

source code 

wsgi application for indicating authorization is required.

Parameters:
  • environ ({str: str})