On Dec 6, 11:58 pm, venkatbo <[EMAIL PROTECTED]> wrote:
> May want to checkout CherryPy's filters for Basic/Digest auth.
> http://www.cherrypy.org/wiki/rfc2617
> using sessions/cookies.
Nice. For those who just want to protect a whole site with simple user/
pass, the following code works:
from turbogears import expose
from turbogears.controllers import RootController
from httpauthfilter import HttpAuthFilter
class Root(RootController):
_cp_filters = [
HttpAuthFilter(
realm='[EMAIL PROTECTED]',
privateKey='foobar',
unauthorizedPath='/denied',
retrieveUsersFunc=lambda: {'foo': 'bar'}
)
]
@expose(template="templates.welcome")
def index(self):
return dict()
@expose(template="templates.denied")
def denied(self):
return dict()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---