Basic user model, authenticator and authorizer for lribeiro.cherrypy.authorizer and mongoengine
Project description
Basic user model, authenticator and authorizer for lribeiro.cherrypy.authorizer and mongoengine
Usage:
import cherrypy
from lribeiro.cherrypy.authorizer import authorize
from lribeiro.cherrypy.authorizer.authentication import AuthControllerDefaultDispatcher
from lribeiro.cherrypy.authorizer.mongoengine.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.mongoengine-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 793292cb6e3d6fbb0e0814bac342c85842596d46f161e0008dada103ae50b6ca |
|
MD5 | a4f222917b7e09fd715ad5d5b2dc7217 |
|
BLAKE2b-256 | 244114bf143b19641b6efa26d7af99099561e0e4a0f2aeda0c5640a6ab659a7a |
Close
Hashes for lribeiro.cherrypy.authorizer.mongoengine-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08391f9a418194f21de470b7ac65212f40402c39c4a03b64077e434d42717749 |
|
MD5 | 69727ea9cc57d5f21043f01965df25e8 |
|
BLAKE2b-256 | f665c94ef5541a9a61fb1f0cd34522e8da52846603b66678922ab5827143be7b |