Easy and secure implementation of Azure Entra ID (previously AD) for your FastAPI APIs 🔒 B2C, single- and multi-tenant support.
MIT License
Bot releases are visible (Hide)
Published by JonasKs almost 3 years ago
Published by JonasKs about 3 years ago
Fixes
Published by JonasKs about 3 years ago
Fixes
Python3.10
and FastAPI==0.70.0
to pipeline matrix ( @jonasks #28 )Published by JonasKs about 3 years ago
Fixes
cryptography
requirement to ^35.0.0
and fix imports ( #26 @bmoore )Published by JonasKs about 3 years ago
This release contains breaking changes for how to setup your application, but also a bunch of new features.
The new documentation contains a full tutorial on how to configure Azure AD and FastAPI for both single- and multi-tenant applications.
v2
token support (and default) for single-tenant applications.iss
(issuers), for those who has multi-tenant applications, but only for specific tenantsaccess_token
for easier Azure Graph implementationSecuriy()
is used (an alternativ to Depends()
)InvalidAuth
to exceptions.py
OAuth2AuthorizationCodeBearer
, solving mypy errors.provider_config.py
to openid_config.py
and ProviderConfig()
to OpenIdConfig()
provider_config
due to OpenAPI authorization URL issues. This is now instanced on SingleTenantAzureAuthorizationCodeBearer
or MultiTenantAzureAuthorizationCodeBearer
.Features implemented in #16 ( @JonasKs )
Published by JonasKs about 3 years ago
3.0.0
.Release notes will be written for the actual release.
Published by JonasKs about 3 years ago
Fixes
upn
an optional field in the User
model, to support Client Credential Flow
( #12 @JonasKs )Published by JonasKs about 3 years ago
Breaking changes
app
parameter from AzureAuthorizationCodeBearer
AzureAuthorizationCodeBearer
now returns a User
object instead of a dictionary with claimsOther
roles
, scp
or similarAzureAuthorizationCodeBearer
Related MR: #11 by @JonasKs
Upgrade guide from v1 to v2
I strongly suggest reading the entire README.md
again, as it's a bit more verbose compared to before.
With that said, these are the steps you have to do in order to bump from v1 to v2:
app=app
from your AzureAuthorizationCodeBearer()
in main.py
.dependencies.py
file or similar, move the azure_scheme = AzureAuthorizationCodeBearer( ... )
to that file.main.py
, import azure_scheme
from dependencies.py
main.py
file, load the provider config on startup:@app.on_event('startup')
async def load_config() -> None:
"""
Load config on startup.
"""
await provider_config.load_config()
tenant_id
, you can also add that to load_config()
@app.on_event('startup')
async def load_config() -> None:
"""
Load config on startup.
"""
+ provider_config.tenant_id = 'my-tenant-id'
await provider_config.load_config()
Published by JonasKs about 3 years ago
Features
kid
, instead of trying all keys ( #10 @JonasKs )Other/Improvements
Published by JonasKs about 3 years ago
Features
Improvements
py.typed
added ( #6 @JonasKs )codecov.yaml
added for codecov updated in PRs ( #6 @JonasKs )Published by JonasKs about 3 years ago