1.1 --- a/WebStack/Generic.py Sat Feb 28 20:55:36 2004 +0000
1.2 +++ b/WebStack/Generic.py Sun Feb 29 00:04:53 2004 +0000
1.3 @@ -305,4 +305,42 @@
1.4
1.5 raise NotImplementedError, "respond"
1.6
1.7 +class Authenticator:
1.8 +
1.9 + "A generic authentication component."
1.10 +
1.11 + def authenticate(self, trans):
1.12 +
1.13 + """
1.14 + An application-specific method which authenticates the sender of the
1.15 + request described by the transaction object 'trans'. This method should
1.16 + consider 'trans' to be read-only and not attempt to change the state of
1.17 + the transaction.
1.18 +
1.19 + If the sender of the request is authenticated successfully, the result
1.20 + of this method evaluates to true; otherwise the result of this method
1.21 + evaluates to false.
1.22 + """
1.23 +
1.24 + raise NotImplementedError, "authenticate"
1.25 +
1.26 + def get_auth_type(self):
1.27 +
1.28 + """
1.29 + An application-specific method which returns the authentication type to
1.30 + be used. An example value is 'Basic' which specifies HTTP basic
1.31 + authentication.
1.32 + """
1.33 +
1.34 + raise NotImplementedError, "get_auth_type"
1.35 +
1.36 + def get_realm(self):
1.37 +
1.38 + """
1.39 + An application-specific method which returns the name of the realm for
1.40 + which authentication is taking place.
1.41 + """
1.42 +
1.43 + raise NotImplementedError, "get_realm"
1.44 +
1.45 # vim: tabstop=4 expandtab shiftwidth=4