aserto-idp 0.3.1

Last updated:

0 purchases

aserto-idp 0.3.1 Image
aserto-idp 0.3.1 Images
Add to Cart

Description:

asertoidp 0.3.1

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
OpenID Connect
from aserto_idp.oidc import identity_provider

Usage
With aserto-authorizer-grpc
from aserto.client 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
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")

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.