Skip to content

Commit

Permalink
fix jwt cookie name settings not being recognised (#972)
Browse files Browse the repository at this point in the history
* fix jwt cookie name settings not being recognised

* Update drf_spectacular/contrib/rest_auth.py

Co-authored-by: T. Franzel <tfranzel@users.noreply.github.com>

---------

Co-authored-by: T. Franzel <tfranzel@users.noreply.github.com>
  • Loading branch information
nixsiow and tfranzel authored Apr 15, 2023
1 parent 4387fed commit f6ad7cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drf_spectacular/contrib/rest_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def get_security_requirement(self, auto_schema):
return [{name: []} for name in self.name]

def get_security_definition(self, auto_schema):
cookie_name = getattr(settings, 'JWT_AUTH_COOKIE', None)
cookie_name = get_dj_rest_auth_setting('JWT_AUTH_COOKIE', 'JWT_AUTH_COOKIE')
if not cookie_name:
cookie_name = 'jwt-auth'
warn(
Expand Down
1 change: 1 addition & 0 deletions tests/contrib/test_rest_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_rest_auth_token(no_warnings, settings):

@pytest.mark.contrib('dj_rest_auth', 'rest_framework_simplejwt')
@mock.patch('django.conf.settings.JWT_AUTH_COOKIE', 'jwt-session', create=True)
@mock.patch('dj_rest_auth.app_settings.api_settings.JWT_AUTH_COOKIE', 'jwt-session', create=True)
def test_rest_auth_simplejwt_cookie(no_warnings):
from dj_rest_auth.jwt_auth import JWTCookieAuthentication

Expand Down

0 comments on commit f6ad7cb

Please sign in to comment.