Basic user model, authenticator and authorizer for lribeiro.cherrypy.authorizer and neomodel
Project description
Basic user model, authenticator and authorizer for lribeiro.cherrypy.authorizer and neomodel
Usage:
import cherrypy
from lribeiro.cherrypy.authorizer import authorize
from lribeiro.cherrypy.authorizer.authentication import AuthControllerDefaultDispatcher
from lribeiro.cherrypy.authorizer.neomodel.auth import authenticator, authorizer
class Root:
@cherrypy.expose
def index(self):
return 'index'
@cherrypy.expose
@authorize
def auth_required(self):
return 'auth required'
@cherrypy.expose
@authorize({'read': 'page', 'write': 'log'})
def authorized(self):
return 'authorized'
@cherrypy.expose
@authorize({'edit': ['page', 'site']})
def unauthorized(self):
return 'unauthorized'
config = {
'/': {
'tools.sessions.on': True,
'tools.authorizer.on': True,
'auth.authenticator': authenticator,
'auth.authorizer': authorizer,
'auth.login_page': '/login'
}
}
if __name__ == '__main__':
root = Root()
root.auth = AuthControllerDefaultDispatcher()
cherrypy.quickstart(root, '/', config)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for lribeiro.cherrypy.authorizer.neomodel-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcc15c44107a4e1fcb15d5ad19523768ff59c8aaa1c974e477f8b70b75614025 |
|
MD5 | 7347d8d2d6ecee078dc234b46f40c203 |
|
BLAKE2b-256 | 1344f3e8e3eb0aea3fb5eca8885f37104aba709dc79d271012687b282a6c2452 |
Close
Hashes for lribeiro.cherrypy.authorizer.neomodel-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bc9ae1e4deafb9e64578fca554fec932446ab2ae1c74fd88609bdef080be0ae |
|
MD5 | bcbe79eae812d8e8b0fbcdf0e35a6eed |
|
BLAKE2b-256 | 53406df1ec8dd9ccec082bb4b49ea2074b159f711ab81b9d46f6021c44735678 |