This repository has been archived by the owner on Oct 12, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
MultiAuth
78 lines (52 loc) · 2.81 KB
/
MultiAuth
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
== MultiAuth ==
MultiAuth provides authentication and access control for CherryPy web objects. It is currently in development and is targeted to be compatible with CherryPy 2.1.
MultiAuth provides a few different means of securing your web objects:
* Decorators
* Allow granular access control for individual methods
* Metaclasses
* Provides an easy way to set base security requirements for all methods in a class
* Inheritance
* Pretty much same as metaclasses (it uses them, actually), just different syntax
== Providers ==
Other than a demo dictionary authentication provider, LDAP authentication (Active Directory, specifically) is the only implemented authentication provider in this release. I also hope to create providers for other authentication methods (Windows, Unix, etc).
Regarding the LDAP authentication, if someone using another LDAP provider (eDirectory for example) would like to look at the code and write an implementation for that provider, I could include it in this package. I would do it but I don't have access to any other LDAP providers at this time.
Adam Svanberg has written a ''very flexible'' database authentication provider for MultiAuth. It utilizes PyDO and can be downloaded from the links at the bottom of this wiki page. The source code includes an usage example.
== Installation ==
Installation is simple. Decompress the zip file and run "python setup.py install".
The installation puts documentation in "site-packages/multiauth/docs" and a few examples in "site-packages/multiauth/examples".
== Example ==
So you can see what I am talking about without having to download the package, here is a simple example included with the distribution:
{{{
#!python
import cherrypy
from multiauth import auth
from multiauth.providers import DictAuthProvider
class SimpleSite:
"Sample multi-level security with decorators"
@cherrypy.expose
def index(self):
return """
<a href="protected">Protected method</a><br>
<a href="open">Open method</a><br>
"""
@cherrypy.expose
@auth.secure(['supersecret'])
def protected(self):
return "you have accessed the protected page"
@cherrypy.expose
def open(self):
return "this is the open page"
# create our silly provider
myProvider = DictAuthProvider({})
myProvider.add('christian', 'secret', ['users'])
myProvider.add('admin', 'sshh', ['users', 'supersecret'])
# set it as auth's provider
auth.provider = myProvider
cherrypy.root = SimpleSite()
# session filter needs to be on
cherrypy.config.update({'sessionFilter.on':True})
cherrypy.server.start()
}}}
== Download ==
Get the latest version at http://projects.dowski.com/projects/multiauth
You can download the PyDOProvider from the link below.