-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
114 additions
and
10 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,21 @@ | ||
# Dev setup | ||
|
||
## Installation | ||
|
||
```bash | ||
pip install .['dev'] | ||
``` | ||
|
||
## Enable pre-commit | ||
|
||
``` | ||
pre-commit install | ||
``` | ||
|
||
## Writing documentation | ||
|
||
Run a live documentation server : | ||
|
||
``` | ||
sphinx-autobuild docs docs/_build/html | ||
``` |
File renamed without changes.
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,23 +1,106 @@ | ||
# Makina Django Oidc | ||
# Makina Django OIDC | ||
|
||
## Dev setup | ||
This library allow *Single Sign On* (SSO) integration into Django through the [Open ID Connect (OIDC)]() protocol. | ||
|
||
### Installation | ||
It can be used to setup a Single Sign On using an identity provider (Keycloak, etc.) or to login using Google, Twitter, etc. | ||
|
||
|
||
## Features | ||
|
||
- Hook system to customize | ||
- BackChannel Logout | ||
|
||
## Documentation | ||
|
||
The documentation is graciously hosted at [readthedocs](). | ||
|
||
## Installation | ||
|
||
First, install the python package : | ||
|
||
```bash | ||
pip install .['dev'] | ||
pip install makina-django-doic | ||
``` | ||
|
||
Then add the library app to your django applications, after `django.contrib.sessions` and `django.contrib.auth` : | ||
|
||
```python | ||
INSTALLED_APPS = [ | ||
"django.contrib.auth", | ||
"django.contrib.sessions", | ||
... | ||
"makina-django-oidc" | ||
] | ||
``` | ||
|
||
### Enable pre-commit | ||
Now you can pick an identity provider from the [available providers](). Create a file named `oidc.py` next to your settings file and initialize your provider there : | ||
|
||
```python | ||
from makina_django_oidc.providers.keycloak_20 import Keycloak20Provider | ||
|
||
my_project_provider = Keycloak20Provider( | ||
op_name="keycloak", | ||
logout_redirect="http://app.local:8082/", | ||
failure_redirect="http://app.local:8082/", | ||
success_redirect="http://app.local:8082/", | ||
redirect_requires_https=False, | ||
client_secret="s3cret", | ||
client_id="my_client_id", | ||
keycloak_realm_uri="http://keycloak.local:8080/", | ||
keycloak_realm="Demo", | ||
) | ||
``` | ||
pre-commit install | ||
|
||
You can then add to your django configuration the following line : | ||
|
||
```python | ||
from .oidc_providers import my_project_provider | ||
|
||
MAKINA_DJANGO_OIDC = { | ||
**my_project_provider.get_config(allowed_hosts=["app.local:8082"]), | ||
} | ||
``` | ||
|
||
## Writing documentation | ||
Finally, add OIDC views to your url configuration (`urls.py`): | ||
|
||
Run a live documentation server : | ||
```python | ||
from .oidc_providers import my_project_provider | ||
|
||
urlpatterns = [ | ||
path("auth", include(my_project_provider.get_urlpatterns())), | ||
] | ||
``` | ||
sphinx-autobuild docs docs/_build/html | ||
``` | ||
|
||
And you are ready to go ! | ||
|
||
## Usage/Examples | ||
|
||
We wrote an extensive collection of 'how-to' guides in the [documentation](). | ||
|
||
## Related | ||
|
||
Here are some related projects | ||
|
||
[Awesome README](https://github.com/matiassingers/awesome-readme) | ||
|
||
## Appendix | ||
|
||
- [Development instructions](./DEVELOPMENT.md) | ||
|
||
## Support | ||
|
||
If you need commercial support (new specific features, custom identity provider integration, etc.), you can always contact Makina Corpus administration at : [email protected]. | ||
|
||
You may also open a ticket, but we can not guarantee that it will be handled in a timely maneer. | ||
|
||
## License | ||
|
||
[GPL](./LICENSE) | ||
|
||
|
||
## Authors | ||
|
||
- [@gbip](https://www.github.com/gbip) | ||
- [@gbip](https://www.github.com/gbip) | ||
|
||
|