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

OpenID Connect

from aserto_idp.oidc import identity_provider

Usage

With aserto-authorizer-grpc

from aserto_authorizer_grpc.aserto.api.v1 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")

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

Uploaded Source

Built Distribution

aserto_idp-0.3.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aserto-idp-0.3.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.7.12 Darwin/21.2.0

File hashes

Hashes for aserto-idp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0b93018c4fab89e0e09e62f991921a9ebe0cc9302b3c0b3b23506d85cf5d3997
MD5 ef7f4534bfd5844a87cee637a10cc36c
BLAKE2b-256 83b1f815f4bb32983cff520d607efcfb1daf74713949ba8846639875841f65ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aserto_idp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.7.12 Darwin/21.2.0

File hashes

Hashes for aserto_idp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dda1029063f7f43fbcf95a4b7ad9a5a8eede10609e3c6e2895dcd60dc3ca8726
MD5 e9f60acebf77aaa7e456e4cfb09c5e71
BLAKE2b-256 10e682e003959c19016df75d78efb8994e4655038057eb3857ecba76762dcc1d

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