maxwin auth
Project description
mwpermission
maxwin 团队 的确权管理
Permission 的使用
> __init__.py 中创建Auth对象
from mwauth.kong_auth import KongAuth
from mwauth.redis_session import RedisSessionInterface
# 会话存redis
rds = FlaskRedis(strict=False)
auth = KongAuth()
# 创建APP
app = Flask(__name__)
# 初始化 app
rds.init_app(app)
auth.init_app(app)
app.session_interface = RedisSessionInterface(app, rds)
> 调用认证代码,代码基于 swagger
# 检查 员工的浏览权限
@auth.valid_login
def employees_id_get(id,jwt = None):
pass
# 检查员工的删除
@auth.valid_login
@p.check('employee',["delete"])
def employees_id_delete(id,jwt = None):
pass
@auth.valid_login
def employee_check_auth():
# 检查是否有看到身份证的权限
p.check_permission('empolyee','see_ID')
安装方法
pip install mwauth
Changes
0.4.22(2018-10-30)
增加readme
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
mwauth-0.4.22.tar.gz
(515.5 kB
view hashes)