Skip to main content

maxwin auth

Project description

rst file editor

mwauth

maxwin 团队 的确权管理

auth的使用

> __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.23(2018-10-30)

  • 修正readme

0.4.22(2018-10-30)

  • 增加readme

Project details


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.23.tar.gz (515.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page