Basic user model, authenticator and authorizer for cherrypy-authorizer and mongoengine
Project description
===============================
cherrypy-authorizer-mongoengine
===============================
Basic user model, authenticator and authorizer for cherrypy-authorizer and mongoengine
Usage:
------
.. sourcecode:: python
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'})
def authorized(self):
return 'authorized'
@cherrypy.expose
@authorize({'edit': 'page'})
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)
cherrypy-authorizer-mongoengine
===============================
Basic user model, authenticator and authorizer for cherrypy-authorizer and mongoengine
Usage:
------
.. sourcecode:: python
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'})
def authorized(self):
return 'authorized'
@cherrypy.expose
@authorize({'edit': 'page'})
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.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3da250933bd53de43c51dd8bd201b22f000bfa3d0c0fed3a72150ec7e4c4057f |
|
MD5 | eba9ef2ce8868e03d55acaffc351d7f6 |
|
BLAKE2b-256 | 89003d671d40ee0f8672ebb424208fd61060b2aa5c33ac25d7b00764f24ae2e5 |
Close
Hashes for lribeiro.cherrypy.authorizer.mongoengine-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09e2f369abcb51dff58d2e68f4c16a526e23e2616da7f65e22e51213857ef45b |
|
MD5 | 9debc720d3b9a5df8baeb481130fd570 |
|
BLAKE2b-256 | 997029a6f44391361e9c996106c6997c0458ecfa9205619e1b4d910753e67a5f |