Package aquarium :: Package parse :: Module Authorization
[show private | hide private]
[frames | no frames]

Module aquarium.parse.Authorization

Parse the Authorization header.


Function Summary
  isHTTPAuthenticated(header, getPasswordCallback)
Is a user HTTP authenticated?

Function Details

isHTTPAuthenticated(header, getPasswordCallback)

Is a user HTTP authenticated?

header
This is the value of the Authorization header or None (e.g. ctx.wsa.getCgiEnv().get("HTTP_AUTHORIZATION")).
getPasswordCallback
This is a callback that takes a username and returns the encrypted password for that username. You may raise a KeyError if that user doesn't exist.

Note, only basic authentication is supported at this time.

If a user isn't HTTP authenticated, you'll probably want to do something like:

ctx.iLib.forward("not_authorized",
                 auth='BASIC realm="My Web Site"')

If they are not authenticated, return False. Otherwise, return a tuple of (username, password).


Generated by Epydoc 2.1 on Mon Jan 1 16:34:19 2007 http://epydoc.sf.net