Revamp authentication (#831)

* Implement Transport classes

* Implement authentication strategy classes

* Revamp authentication with Transport and Strategy

* Revamp strategy and OAuth so that they can use a callable dependency

* Update docstring

* Make ErrorCode a proper Enum and cleanup unused OpenAPI utils

* Remove useless check

* Tweak typing in authenticator

* Update docs

* Improve logout/destroy token logic

* Update docs

* Update docs

* Update docs and full examples

* Apply formatting to examples

* Update OAuth doc and examples

* Add migration doc

* Implement Redis session token

* Add Redis Session documentation

* RedisSession -> Redis

* Fix links in docs
This commit is contained in:
François Voron
2021-12-30 15:22:07 +01:00
committed by GitHub
parent 72ab480aba
commit c4de66b81c
125 changed files with 3144 additions and 1344 deletions

View File

@ -19,8 +19,8 @@ In Python, when we want to use a generator, we have to use a `for` loop, which w
In the following sample, we import our dependencies and create a context manager version using `contextlib.asynccontextmanager`:
```py hl_lines="9 10"
{!./src/cookbook_create_user_programmatically.py!}
```py hl_lines="8 9"
--8<-- "docs/src/cookbook_create_user_programmatically.py"
```
!!! info "I have other dependencies"
@ -30,8 +30,8 @@ In the following sample, we import our dependencies and create a context manager
We are now ready to write a function. The example below shows you a basic example but you can of course adapt it to your own needs. The key part here is once again to **take care of opening every context managers and pass them every required arguments**, as the dependency manager would do.
```py hl_lines="13-24"
{!./src/cookbook_create_user_programmatically.py!}
```py hl_lines="12-23"
--8<-- "docs/src/cookbook_create_user_programmatically.py"
```
## 3. Use it