diff --git a/docs/settings.md b/docs/settings.md index ba16f95..24fef7e 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -39,15 +39,25 @@ web token refresh and web sign out. Defaults to `"/api/auth/web"`. This is the field on the User model that is used as the username. Defaults to `"username"`. ### TOKEN_CLAIM_USER_ATTRIBUTE_MAP -A dictionary mapping token claims to corresponding User model attributes. Defaults to the following: +A dictionary mapping token claims to corresponding User model attributes. Defaults to the following which are part +of Django's default User model: ```python { "user_id": "id", "username": "username", + "first_name": "first_name", + "last_name": "last_name", + "email": "email", + "is_staff": "is_staff", + "is_superuser": "is_superuser", "last_login": "last_login", + "date_joined": "date_joined", + "is_active": "is_active", } ``` -See [Customizing token claims for user](../readme.md#customizing-token-claims-for-user). +If you changed any of these attributes in your Django user model, you will need to update this dictionary accordingly. + +See also: [Customizing token claims for user](../readme.md#customizing-token-claims-for-user). ### TOKEN_USER_ENCODER_CLS JSON encoder class used to serializing User attributes to JWT claims. diff --git a/ninja_simple_jwt/settings.py b/ninja_simple_jwt/settings.py index 9769ae0..b3bc1f1 100644 --- a/ninja_simple_jwt/settings.py +++ b/ninja_simple_jwt/settings.py @@ -41,7 +41,14 @@ class NinjaSimpleJwtSettingsDict(TypedDict): "TOKEN_CLAIM_USER_ATTRIBUTE_MAP": { "user_id": "id", "username": "username", + "first_name": "first_name", + "last_name": "last_name", + "email": "email", + "is_staff": "is_staff", + "is_superuser": "is_superuser", "last_login": "last_login", + "date_joined": "date_joined", + "is_active": "is_active", }, "TOKEN_USER_ENCODER_CLS": "ninja_simple_jwt.jwt.json_encode.TokenUserEncoder", } diff --git a/setup.cfg b/setup.cfg index 1eda471..d060218 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = django-ninja-simple-jwt -version = 0.6.0 +version = 0.6.1 description = Simple JWT-based authentication using Django and Django-ninja long_description = file: README.md url = https://github.com/oscarychen/django-ninja-simple-jwt