Skip to content

Commit eb618d8

Browse files
committed
remove django-braces dependency
1 parent 231d4b0 commit eb618d8

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

rest_framework_social_oauth2/views.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# -*- coding: utf-8 -*-
22
import json
33

4-
from braces.views import CsrfExemptMixin
54
from django.urls import reverse
5+
from django.utils.decorators import method_decorator
6+
from django.views.decorators.csrf import csrf_exempt
67
from oauthlib.oauth2.rfc6749.endpoints.token import TokenEndpoint
78
from social_core.exceptions import MissingBackend
89
from social_django.utils import load_strategy, load_backend
@@ -25,6 +26,18 @@
2526
from .oauth2_endpoints import SocialTokenServer
2627

2728

29+
class CsrfExemptMixin(object):
30+
"""
31+
Exempts the view from CSRF requirements.
32+
NOTE:
33+
This should be the left-most mixin of a view.
34+
"""
35+
36+
@method_decorator(csrf_exempt)
37+
def dispatch(self, *args, **kwargs):
38+
return super(CsrfExemptMixin, self).dispatch(*args, **kwargs)
39+
40+
2841
class TokenView(CsrfExemptMixin, OAuthLibMixin, APIView):
2942
"""
3043
Implements an endpoint to provide access tokens

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
'djangorestframework>=3.0.1',
2525
'django-oauth-toolkit>=0.9.0',
2626
'social-auth-app-django>=0.1.0',
27-
'django-braces>=1.11.0',
2827
],
2928
include_package_data=True,
3029
zip_safe=False,

0 commit comments

Comments
 (0)