Common identity providers for use with Aserto client libraries
Project description
Aserto Identity Providers
Common identity providers for use with Aserto client libraries
Installation
Using Pip
pip install aserto-idp
Using Poetry
poetry add aserto-idp
Current Identity Providers
Auth0
from aserto_idp.auth0 import generate_oauth_subject_from_auth_header
Stay tuned for more!
Usage
With aserto-authorizer-grpc
from aserto_authorizer_grpc.aserto.api.v1 import IdentityContext, IdentityType
from aserto_idp.auth0 import AccessTokenError, generate_oauth_subject_from_auth_header
try:
subject = await generate_oauth_subject_from_auth_header(
authorization_header=request.headers["Authorization"],
domain=AUTH0_DOMAIN,
client_id=AUTH0_CLIENT_ID,
audience=AUTH0_AUDIENCE,
)
identity_context = IdentityContext(
type=IdentityType.IDENTITY_TYPE_SUB,
identity=subject,
)
except AccessTokenError:
identity_context = IdentityContext(type=IdentityType.IDENTITY_TYPE_NONE)
With aserto
from aserto import Identity
from aserto_idp.auth0 import AccessTokenError, generate_oauth_subject_from_auth_header
try:
subject = await generate_oauth_subject_from_auth_header(
authorization_header=request.headers["Authorization"],
domain=AUTH0_DOMAIN,
client_id=AUTH0_CLIENT_ID,
audience=AUTH0_AUDIENCE,
)
identity = Identity(type="SUBJECT", subject=subject)
except AccessTokenError:
identity = Identity(type="NONE")
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
aserto-idp-0.2.1.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file aserto-idp-0.2.1.tar.gz
.
File metadata
- Download URL: aserto-idp-0.2.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.8 CPython/3.7.12 Darwin/21.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5af642d8267d66c60edc66ca5b1992865b784c7c5b568fec4595ad488e22a088 |
|
MD5 | 5597171f1b9e0f8eca842836806a7232 |
|
BLAKE2b-256 | 8a4ee567d76e7be83af534378f3fe2d7565cd772c79088a2cd4ee7cde54ac04b |
File details
Details for the file aserto_idp-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: aserto_idp-0.2.1-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.8 CPython/3.7.12 Darwin/21.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88e9ecd80e514b87d787eb90883a1074d95ccc3c63175ed04ac1531dd859badd |
|
MD5 | 4e3b6f6f0d12fc77d54bf6b184406597 |
|
BLAKE2b-256 | 927d9dc1de4d8903276187218d2935a3457ce19bb41de1dd916dd69ff5ba7c35 |