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 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.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

aserto_idp-0.2.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file aserto-idp-0.2.0.tar.gz.

File metadata

  • Download URL: aserto-idp-0.2.0.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.6.0

File hashes

Hashes for aserto-idp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6baab18b092aa382c7cbde98101b357dfa509f5e3b820a73974a2549bdd5fd51
MD5 21a945abc5fc3c912461128b5096092e
BLAKE2b-256 20911d4657aa58840788b94e30e111953f06be8f5099405023fd8039b7e6f0be

See more details on using hashes here.

File details

Details for the file aserto_idp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: aserto_idp-0.2.0-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.6.0

File hashes

Hashes for aserto_idp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 663380828ebdf851dfcd96932bb616ee4c89642862189a633496c739d8022057
MD5 3c99bd2acfdb9f3a75ed681fd872f586
BLAKE2b-256 476f99401f18469f0406e69134f247f276d98a7af57542f3392106af2a8e433a

See more details on using hashes here.

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