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 provide_identity
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, provide_identity
try:
identity = await provide_identity(
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=identity,
)
except AccessTokenError:
identity_context = IdentityContext(type=IdentityType.IDENTITY_TYPE_NONE)
With aserto
from aserto import Identity
from aserto_idp.auth0 import AccessTokenError, provide_identity
try:
subject = await provide_identity(
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.1.1.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file aserto-idp-0.1.1.tar.gz
.
File metadata
- Download URL: aserto-idp-0.1.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.11 Darwin/20.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85f35caa362e0f018cf774005e00771fce4e4213b9ff0571a579f12604ffe6b6 |
|
MD5 | cec929b2f4c41ea369a63985f184668f |
|
BLAKE2b-256 | 7be3eab3636244d446d52e212c42187c4372a617dcc7e4976cf31b34c54a4139 |
File details
Details for the file aserto_idp-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: aserto_idp-0.1.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.11 Darwin/20.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5a5488ac6d59028afc8575e02c8689f7f1d1e9d0bba345d9eca3b952b2827b5 |
|
MD5 | 16c622ac49b3758d08780f580edb4c6d |
|
BLAKE2b-256 | e41aca3fc4186d6e20088316be7102c5a9589026f178ec0529c0d4eef08ab232 |