Skip to main content

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 hashes)

Uploaded Source

Built Distribution

aserto_idp-0.1.1-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page