close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.
- Timestamp:
-
Aug 22, 2008, 10:19:12 PM (16 years ago)
- Author:
-
cmlenz
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v12
|
v13
|
|
1 | | = Framework for Authentication and Authorization = |
| 1 | = Authentication and Authorization = |
2 | 2 | |
3 | | This page describes an [source:branches/experimental/auth-framework experimental branch] that adds a simple generic auth framework to Diva. |
| 3 | Diva includes a simple but flexible subsystem for authentication and authorization. |
4 | 4 | |
5 | | The main goals of this framework are: |
| 5 | The main goals of this subsystem are: |
6 | 6 | |
7 | 7 | * Enable relatively easy switching between HTTP authentication (such as `Basic` or `Digest` authentication performed by the web server) and form-based authentication. |
… |
… |
|
11 | 11 | * No restriction to a specific method of controlling access to resources (such as ACLs). Applications can use whatever access control granularity they need. |
12 | 12 | * Storage-independent generation and verification of authentication cookies for form-based login. |
13 | | |
14 | | Possible/peripheral goals: |
15 | | |
16 | 13 | * Utility functions for generating and verifying encrypted passwords. |
17 | 14 | * WSGI middleware for using HTTP authentication, primarily in the context of the DevelopmentServer |
18 | 15 | |
19 | | All of the above is implemented on the branch at this point. |
20 | | |
21 | | Non-goals include: |
22 | | |
23 | | * Built-in processes and UI for user registration, activation, password resetting, and other high-level features. |
| 16 | The subsystem does not provide built-in processes and UI for user registration, activation, password resetting, and other high-level features. |
24 | 17 | |
25 | 18 | === Open Issues === |
… |
… |
|
30 | 23 | * The password encryption utilities are a bit on the silly side. They should either be really useful or get nixed. |
31 | 24 | |
32 | | == High-Level Architecture Stuff == |
| 25 | == Basic Architecture == |
33 | 26 | |
34 | | === Application Mixin Approach === |
35 | | |
36 | | The current branch defines an `AuthMixIn` class that auth-enabled applications are supposed to subclass. It adds a couple of method stubs to the `Application` class, and contributes a [wiki:RequestFilters request filter] that performs authentication. |
| 27 | The `diva.auth` module provides an `AuthMixIn` class that auth-enabled applications are supposed to subclass. It adds a couple of method stubs to `Application` subclasses, and contributes a [wiki:RequestFilters request filter] that performs authentication. |
37 | 28 | |
38 | 29 | A concrete application would inherit from `AuthMixIn` in addition to being derived from [wiki:ApplicationObject Application], and would probably want to implement two methods for handling the domain-specific details of identifying users and controlling their access to certain actions and/or resources. For example: |
… |
… |
|
51 | 42 | return True |
52 | 43 | }}} |
53 | | |
54 | | === Filters Refactoring === |
55 | | |
56 | | Due to the way application mix-in classes can contribute filters, ordering request filters explicitly becomes too painful. The branch enhances the way request filters are defined by allowing them to declare the abstract service they provide (such as "localization" or "error-handling"), and also declare what services they rely on to do their job. For example: |
57 | | |
58 | | {{{ |
59 | | #!python |
60 | | @filters.register('form-processing', requires=['templating', 'localization']) |
61 | | def form_filter(request, response, chain): |
62 | | ... |
63 | | }}} |
64 | | |
65 | | The ordering of request filters is then inferred from this dependency information. |
66 | 44 | |
67 | 45 | == Authentication Methods == |