django-identities
Releases
This project follows the semantic versioning specification for its releases.
Development
Requirements
- Python >=3.10
- Django >=3.2
- django-rest-framework >=3.12
Setup
- Create and activate a python3 venv.
- Install the library in the editable mode
pip install -e .[test,stubs] - Install dev requirements
pip install -r requirements-dev.txt. - Install git hooks to automatically format code using black with
pre-commit install
Migrations
To create migrations after modifying database models run ./manage.py makemigrations
Installation
From git in requirements.txt
-
To install this package from this git repository, add the
django-identitiespackage to therequirements.txtfile. -
Add
guardianandidentitiestosettings.INSTALLED_APPS:
INSTALLED_APPS = (
#...
'guardian',
'identities',
#...
)
- Add the following to your
settings, replacing all values withREPLACEwith your configuration:
AUTH_USER_MODEL = "identities.User"
GUARDIAN_MONKEY_PATCH = False
GUARDIAN_GET_INIT_ANONYMOUS_USER = "identities.models.get_anonymous_user_instance"
AUTHENTICATION_BACKENDS = [
"django.contrib.auth.backends.ModelBackend",
"guardian.backends.ObjectPermissionBackend",
]
AUTHLIB_OAUTH_CLIENTS = {
"identity_provider": {
"client_id": "REPLACE OIDC client_id",
"client_secret": "REPLACE OIDC client_secret",
"server_metadata_url": "REPLACE OIDC config_url",
"client_kwargs": {"scope": "openid email profile"},
}
}
LOGIN_REDIRECT_URL = "REPLACE OIDC login_redirect_url"
LOGOUT_REDIRECT_URL = "REPLACE OIDC logout_redirect_url"
- In
<app>/urls.py, extendurlpatternslike this:
urlpatterns = [
#...
re_path(r"^backend/identity/", include("identities.urls")),
re_path(
r"^backend/identity/auth/local/",
include("rest_framework.urls", namespace="rest_framework"),
),
#...
]
- Extend the file
<app>/templates/rest_framework/base.htmlwith the following:
{% if user.is_authenticated %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
{{ user.email }}
<b class="caret"></b>
</a>
<ul class="dropdown-menu" style="padding: 0;">
<form action="{% url 'identities:oidc-logout' %}" method="post">
{% csrf_token %}
<button name="logout" value="logout" class="btn btn-default btn-block">
Log out
</button>
</form>
</ul>
</li>
{% else %}
<li>
<a href="{% url 'identities:oidc-authenticate' %}">Log in (federation)</a>
</li>
<li>
<a href="{% url 'rest_framework:login' %}">Log in (local)</a>
</li>
{% endif %}
-
Run
./manage.py migrate -
Restart your application server
Metadata
Release files for django-identities 2.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-identities-2.3.1.tar.gz | 19.5 kB | Without provenance | Details for django-identities-2.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_identities-2.3.1-py3-none-any.whl | Python 3 | none | any | Details for django_identities-2.3.1-py3-none-any.whl |
Total release size: 43.6 kB
Release files / django-identities-2.3.1.tar.gz
| Download URL | django-identities-2.3.1.tar.gz |
|---|---|
| Size | 19.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ecf0c90a528f341dbf0b45ee150fbc514caa9b37daef2446805a64d9d1dedb8
|
|
BLAKE2b-256 checksum How to use checksums |
27a171a411558ef9e818535bf6fb43108abf82ec2b8818ac928ee9c234fcc719
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / django_identities-2.3.1-py3-none-any.whl
| Download URL | django_identities-2.3.1-py3-none-any.whl |
|---|---|
| Size | 24.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c13c1020d6d82770b103dbe2d5e058ce2fcee0a4ea1d7d12a55ec68c111d532
|
|
BLAKE2b-256 checksum How to use checksums |
e4cb8a3ec5fbe6679487cdcec244044f222c46bdb5e450435a7ae5a14d3f5144
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for django-identities 2.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.