Skip to content

Commit 98f19ce

Browse files
authored
Merge pull request #2 from eadwinCode/simple_jwt_merge
Simple jwt merge
2 parents 11ce394 + 44cdd5a commit 98f19ce

File tree

3 files changed

+60
-1
lines changed

3 files changed

+60
-1
lines changed

CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Code of Conduct
2+
3+
As contributors and maintainers of the Jazzband projects, and in the interest of
4+
fostering an open and welcoming community, we pledge to respect all people who
5+
contribute through reporting issues, posting feature requests, updating documentation,
6+
submitting pull requests or patches, and other activities.
7+
8+
We are committed to making participation in the Jazzband a harassment-free experience
9+
for everyone, regardless of the level of experience, gender, gender identity and
10+
expression, sexual orientation, disability, personal appearance, body size, race,
11+
ethnicity, age, religion, or nationality.
12+
13+
Examples of unacceptable behavior by participants include:
14+
15+
- The use of sexualized language or imagery
16+
- Personal attacks
17+
- Trolling or insulting/derogatory comments
18+
- Public or private harassment
19+
- Publishing other's private information, such as physical or electronic addresses,
20+
without explicit permission
21+
- Other unethical or unprofessional conduct
22+
23+
The Jazzband roadies have the right and responsibility to remove, edit, or reject
24+
comments, commits, code, wiki edits, issues, and other contributions that are not
25+
aligned to this Code of Conduct, or to ban temporarily or permanently any contributor
26+
for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
27+
28+
By adopting this Code of Conduct, the roadies commit themselves to fairly and
29+
consistently applying these principles to every aspect of managing the jazzband
30+
projects. Roadies who do not follow or enforce the Code of Conduct may be permanently
31+
removed from the Jazzband roadies.
32+
33+
This code of conduct applies both within project spaces and in public spaces when an
34+
individual is representing the project or its community.
35+
36+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
37+
contacting the roadies at `[email protected]`. All complaints will be reviewed and
38+
investigated and will result in a response that is deemed necessary and appropriate to
39+
the circumstances. Roadies are obligated to maintain confidentiality with regard to the
40+
reporter of an incident.
41+
42+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version
43+
1.3.0, available at [https://contributor-covenant.org/version/1/3/0/][version]
44+
45+
[homepage]: https://contributor-covenant.org
46+
[version]: https://contributor-covenant.org/version/1/3/0/

docs/docs/settings.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Some of Simple JWT's behavior can be customized through settings variables in
3737
3838
'AUTH_TOKEN_CLASSES': ('ninja_jwt.tokens.AccessToken',),
3939
'TOKEN_TYPE_CLAIM': 'token_type',
40+
'TOKEN_USER_CLASS': 'ninja_jwt.models.TokenUser',
4041
4142
'JTI_CLAIM': 'jti',
4243
@@ -235,6 +236,14 @@ identifier is used to identify revoked tokens in the blacklist app. It may be
235236
necessary in some cases to use another claim besides the default "jti" claim to
236237
store such a value.
237238

239+
``TOKEN_USER_CLASS``
240+
--------------------
241+
242+
A stateless user object which is backed by a validated token. Used only for
243+
the experimental JWTTokenUserAuthentication authentication backend. The value
244+
is a dotted path to your subclass of ``rest_framework_simplejwt.models.TokenUser``,
245+
which also is the default.
246+
238247
``SLIDING_TOKEN_LIFETIME``
239248
--------------------------
240249

ninja_jwt/schema.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import Dict, Optional, Type, cast
22

3+
from django.conf import settings
34
from django.contrib.auth import authenticate, get_user_model
45
from django.contrib.auth.models import AbstractUser, update_last_login
56
from django.utils.translation import gettext_lazy as _
@@ -214,7 +215,10 @@ def validate_schema(cls, values: Dict) -> dict:
214215
raise exceptions.ValidationError({"token": "token is required"})
215216
token = UntypedToken(values["token"])
216217

217-
if api_settings.BLACKLIST_AFTER_ROTATION:
218+
if (
219+
api_settings.BLACKLIST_AFTER_ROTATION
220+
and "ninja_jwt.token_blacklist" in settings.INSTALLED_APPS
221+
):
218222
jti = token.get(api_settings.JTI_CLAIM)
219223
if BlacklistedToken.objects.filter(token__jti=jti).exists():
220224
raise exceptions.ValidationError("Token is blacklisted")

0 commit comments

Comments
 (0)