flask-aserto-0.5.0rc2
توضیحات
Aserto integration for Flask
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | flask-aserto-0.5.0rc2 |
| نام | flask-aserto |
| نسخه کتابخانه | 0.5.0rc2 |
| نگهدارنده | ['authereal'] |
| ایمیل نگهدارنده | ['authereal@aserto.com'] |
| نویسنده | Aserto, Inc. |
| ایمیل نویسنده | pypi@aserto.com |
| آدرس صفحه اصلی | https://github.com/aserto-dev/aserto-python/tree/HEAD/packages/flask-aserto |
| آدرس اینترنتی | https://pypi.org/project/flask-aserto/ |
| مجوز | Apache-2.0 |
# Aserto Flask middleware
This is the official library for integrating [Aserto](https://www.aserto.com/) authorization into your [Flask](https://github.com/pallets/flask) applications.
For a example of what this looks like in a running Flask app and guidance on connecting an identity provider, see the [PeopleFinder app example](https://github.com/aserto-dev/aserto-python/tree/main/packages/flask-aserto/peoplefinder_example).
## Features
### Add authorization checks to your routes
```py
from flask_aserto import AsertoMiddleware, AuthorizationError
app = Flask(__name__)
aserto = AsertoMiddleware(**aserto_options)
@app.route("/api/users/<id>", methods=["GET"])
@aserto.authorize
def api_user(id: str) -> Response:
# Raises an AuthorizationError if the `GET.api.users.__id`
# policy returns a decision of "allowed = false"
...
```
### Automatically create a route to serve a [Display State Map](https://docs.aserto.com/docs/authorizer-guide/display-state-map)
```py
# Defaults to creating a route at the path "/__displaystatemap"
aserto.register_display_state_map(app)
```
### Perform more finely controlled authorization checks
```py
@app.route("/api/users/<id>", methods=["GET"])
async def api_user(id: str) -> Response:
# This also automatically knows to check the `GET.api.users.__id` policy
if not await aserto.check("allowed"):
raise AuthorizationError()
...
```
نیازمندی
| مقدار | نام |
|---|---|
| >=3.10.0,<4.0.0 | typing-extensions |
| >=2.0.1,<3.0.0 | Flask[async] |
| >=3.0.10,<4.0.0 | Flask-Cors |
| >=1.49.1,<2.0.0 | grpcio |
| >=4.21.7,<5.0.0 | protobuf |
| >=0.20.0,<0.21.0 | aserto |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7,<4.0 | Python |
نحوه نصب
نصب پکیج whl flask-aserto-0.5.0rc2:
pip install flask-aserto-0.5.0rc2.whl
نصب پکیج tar.gz flask-aserto-0.5.0rc2:
pip install flask-aserto-0.5.0rc2.tar.gz