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).
-
|