aserto-idp-0.3.0
توضیحات
Common identity providers for use with Aserto client libraries
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | aserto-idp-0.3.0 |
| نام | aserto-idp |
| نسخه کتابخانه | 0.3.0 |
| نگهدارنده | ['authereal'] |
| ایمیل نگهدارنده | ['authereal@aserto.com'] |
| نویسنده | Aserto, Inc. |
| ایمیل نویسنده | pypi@aserto.com |
| آدرس صفحه اصلی | https://github.com/aserto-dev/aserto-python/tree/HEAD/packages/aserto-idp |
| آدرس اینترنتی | https://pypi.org/project/aserto-idp/ |
| مجوز | Apache-2.0 |
# Aserto Identity Providers
Common identity providers for use with Aserto client libraries
## Installation
### Using Pip
```sh
pip install aserto-idp
```
### Using Poetry
```sh
poetry add aserto-idp
```
## Current Identity Providers
### OpenID Connect
```py
from aserto_idp.oidc import identity_provider
```
## Usage
### With [`aserto-authorizer-grpc`](https://github.com/aserto-dev/aserto-python/tree/HEAD/packages/aserto-authorizer-grpc)
```py
from aserto_authorizer_grpc.aserto.api.v1 import IdentityContext, IdentityType
from aserto_idp.oidc import AccessTokenError, identity_provider
oidc_provider = identity_provider(issuer=OIDC_ISSUER, client_id=OIDC_CLIENT_ID)
try:
subject = await oidc_provider.subject_from_jwt_auth_header(request.headers["Authorization"])
identity_context = IdentityContext(
type=IdentityType.IDENTITY_TYPE_SUB,
identity=subject,
)
except AccessTokenError:
identity_context = IdentityContext(type=IdentityType.IDENTITY_TYPE_NONE)
```
### With [`aserto`](https://github.com/aserto-dev/aserto-python/tree/HEAD/packages/aserto)
```py
from aserto import Identity
from aserto_idp.oidc import AccessTokenError, IdentityProvider
oidc_provider = identity_provider(issuer=OIDC_ISSUER, client_id=OIDC_CLIENT_ID)
try:
subject = await oidc_provider.subject_from_jwt_auth_header(request.headers["Authorization"])
identity = Identity(type="SUBJECT", subject=subject)
except AccessTokenError:
identity = Identity(type="NONE")
```
نیازمندی
| مقدار | نام |
|---|---|
| >=3.8.1,<4.0.0 | aiohttp |
| >=3.3.0,<4.0.0 | python-jose[cryptography] |
| >=3.10.0,<4.0.0 | typing-extensions |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7,<4.0 | Python |
نحوه نصب
نصب پکیج whl aserto-idp-0.3.0:
pip install aserto-idp-0.3.0.whl
نصب پکیج tar.gz aserto-idp-0.3.0:
pip install aserto-idp-0.3.0.tar.gz