Catalog PyPI
Back to packageRELEASE DETAILS

0.1.5

PyPI

aad

Async Python SDK for validating Azure AD B2C access tokens

Published17 Mar 2024
Direct dependencies4
Transitive dependenciesNot calculated

README

Version 0.1.5 documentation

Azure AD B2C

Simplified Python SDK for verifying AD B2C-issued JWTs

Usage

import aad

token = "..." # JWT to verify
tenant = "..." # B2C tenant (as in `"{tenant}.b2clogin.com/{tenant}..."`)
app_id = "..." # ClientID of app registered in the B2C tenant
policy = "B2C_1_..." # policy (aka user flow) name

await aad.authorize(token, tenant, app_id, policy)
# {
#   "idp": "...",
#   "aud": "...",
#   ... # other JWT fields
#   ... # fields configured in B2C
# }

FastAPI dependency

pip install aad[fastapi]
from fastapi import FastAPI
import aad

Claims = aad.claims(tenant, app_id, policy)
app = FastAPI()

@app.get("...")
def get(claims: Claims):
    ...

Disclaimer

The JWT decoding part is heavily inspired by azure-ad-verify-token, but with an async interface

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 4

Native requirements
4 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
aiohttp
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
aiohttpruntime
pydantic
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pydanticruntime
pyjwt
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
pyjwtruntime
fastapi
Environment
{
  "extras": "",
  "marker": "extra == 'fastapi'",
  "requires_python": ">=3.10",
  "evaluation": "NOT_EVALUATED"
}
fastapi ; extra == 'fastapi'runtime

Distribution files

2 collected
aad-0.1.5-py3-none-any.whl

bdist_wheel · 4.99 KB · Python py3

Source file
aad-0.1.5.tar.gz

sdist · 4.13 KB · Python source

Source file

Repository

PENDING
moveread/azure-sdks

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 16:51 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:630ff3889a41afd468fc0858510cd7802da766e51caea6ccb59c4de1f737f45f

Other collected versions

View all collected versions →