-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.3.0 - new features, breaking API changes and 100% test coverage
### Added - OAuth2 and OIDC can now be enabled by just passing an OIDC discovery URL to `FastAPISecurity.init_oauth2_through_oidc` - Cached data is now used for JWKS and OIDC endpoints in case the "refresh requests" fail. ### Changed - `UserPermission` objects are now created via `FastAPISecurity.user_permission`. - `FastAPISecurity.init` was split into three distinct methods: `.init_basic_auth`, `.init_oauth2_through_oidc` and `.init_oauth2_through_jwks`. - Broke out the `permission_overrides` argument from the old `.init` method and added a distinct method for adding new overrides `add_permission_overrides`. This method can be called multiple times. - The dependency `FastAPISecurity.has_permission` and `FastAPISecurity.user_with_permissions` has been replaced by `FastAPISecurity.user_holding`. API is the same (takes a variable number of UserPermission arguments, i.e. compatible with both). ### Removed - Remove `app` argument to the `FastAPISecurity.init...` methods (it wasn't used before) - The global permissions registry has been removed. Now there should be no global mutable state left.
- Loading branch information
1 parent
cb134b9
commit b71b841
Showing
36 changed files
with
1,280 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
- Nothing | ||
|
||
## [0.3.0](https://github.com/jmagnusson/fastapi-security/compare/v0.2.0...v0.3.0) - 2021-03-26 | ||
|
||
### Added | ||
|
||
- OAuth2 and OIDC can now be enabled by just passing an OIDC discovery URL to `FastAPISecurity.init_oauth2_through_oidc` | ||
- Cached data is now used for JWKS and OIDC endpoints in case the "refresh requests" fail. | ||
|
||
### Changed | ||
- `UserPermission` objects are now created via `FastAPISecurity.user_permission`. | ||
- `FastAPISecurity.init` was split into three distinct methods: `.init_basic_auth`, `.init_oauth2_through_oidc` and `.init_oauth2_through_jwks`. | ||
- Broke out the `permission_overrides` argument from the old `.init` method and added a distinct method for adding new overrides `add_permission_overrides`. This method can be called multiple times. | ||
- The dependency `FastAPISecurity.has_permission` and `FastAPISecurity.user_with_permissions` has been replaced by `FastAPISecurity.user_holding`. API is the same (takes a variable number of UserPermission arguments, i.e. compatible with both). | ||
|
||
### Removed | ||
- Remove `app` argument to the `FastAPISecurity.init...` methods (it wasn't used before) | ||
- The global permissions registry has been removed. Now there should be no global mutable state left. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
# FastAPI Security Example App | ||
# FastAPI-Security Example App | ||
|
||
To try out: | ||
|
||
```bash | ||
pip install fastapi-security uvicorn | ||
export OIDC_DISCOVERY_URL='https://my-auth0-tenant.eu.auth0.com/.well-known/openid-configuration' | ||
export OAUTH2_AUDIENCES='["my-audience"]' | ||
export BASIC_AUTH_CREDENTIALS='[{"username": "user1", "password": "test"}]' | ||
export AUTH_JWKS_URL='https://my-auth0-tenant.eu.auth0.com/.well-known/jwks.json' | ||
export AUTH_AUDIENCES='["my-audience"]' | ||
export PERMISSION_OVERRIDES='{"user1": ["products:create"]}' | ||
uvicorn app1:app | ||
``` | ||
|
||
You would need to replace the `my-auth0-tenant.eu.auth0.com` part to make it work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.