1.1 --- a/examples/Common/Auth/__init__.py Sun Feb 29 00:06:25 2004 +0000
1.2 +++ b/examples/Common/Auth/__init__.py Sun Feb 29 00:06:37 2004 +0000
1.3 @@ -9,12 +9,6 @@
1.4 "A resource demanding authentication."
1.5
1.6 def respond(self, trans):
1.7 - user = trans.get_user()
1.8 - if user is None:
1.9 - trans.set_response_code(401)
1.10 - trans.set_header_value("WWW-Authenticate", 'Basic realm="AuthResource"')
1.11 - return
1.12 -
1.13 trans.set_content_type(WebStack.Generic.ContentType("text/html"))
1.14
1.15 # Write out confirmation, otherwise.
1.16 @@ -28,7 +22,21 @@
1.17 </body>
1.18 </html>
1.19 """ % (
1.20 - user,
1.21 + trans.get_user(),
1.22 ))
1.23
1.24 +class AuthAuthenticator:
1.25 +
1.26 + "An authenticator for the application."
1.27 +
1.28 + def authenticate(self, trans):
1.29 + user = trans.get_user()
1.30 + return user is not None
1.31 +
1.32 + def get_auth_type(self):
1.33 + return "Basic"
1.34 +
1.35 + def get_realm(self):
1.36 + return "AuthResource"
1.37 +
1.38 # vim: tabstop=4 expandtab shiftwidth=4