Basic user model, authenticator and authorizer for cherrypy-authorizer and neomodel
Project description
===============================
cherrypy-authorizer-mongoengine
===============================
Basic user model, authenticator and authorizer for cherrypy-authorizer and neomodel
Usage:
------
.. sourcecode:: python
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'})
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 neomodel
Usage:
------
.. sourcecode:: python
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'})
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.neomodel-1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d24aa97f01b298cb69edc27399e2e4f9547681c3429df7fa1cb66b79cdcd84d |
|
MD5 | 44367c800a9feed880d7ddb44e291f11 |
|
BLAKE2b-256 | b8f4be36931a520434d065d8a0708be51a5ff6902b1885125c2dfa7ebd35d49b |
Close
Hashes for lribeiro.cherrypy.authorizer.neomodel-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53fe176ae6ac44efc07c1c86c1a614c5744d4a41e7afedc3d0cfadb2cb0a58c3 |
|
MD5 | 915922a62cee03feaacea753d3dbad73 |
|
BLAKE2b-256 | b063ae25452877a057ee35a1c4f0192f78f5db9f60c16986ad50f4a41ee05b9d |