Skip to content

Commit 79cfffe

Browse files
committed
oauth2 validator class from settings, refs issue #19
1 parent 0b3712e commit 79cfffe

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

oauth2_provider/views/base.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from ..exceptions import OAuthToolkitError
1212
from ..forms import AllowForm
1313
from ..models import get_application_model
14-
from ..oauth2_validators import OAuth2Validator
1514
from .mixins import OAuthLibMixin
1615

1716
Application = get_application_model()
@@ -67,7 +66,7 @@ class AuthorizationView(BaseAuthorizationView, FormView):
6766
form_class = AllowForm
6867

6968
server_class = Server
70-
validator_class = OAuth2Validator
69+
validator_class = oauth2_settings.OAUTH2_VALIDATOR_CLASS
7170

7271
def get_initial(self):
7372
# TODO: move this scopes conversion from and to string into a utils function
@@ -129,7 +128,7 @@ class TokenView(CsrfExemptMixin, OAuthLibMixin, View):
129128
* Client credentials
130129
"""
131130
server_class = Server
132-
validator_class = OAuth2Validator
131+
validator_class = oauth2_settings.OAUTH2_VALIDATOR_CLASS
133132

134133
def post(self, request, *args, **kwargs):
135134
url, headers, body, status = self.create_token_response(request)

oauth2_provider/views/generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from oauthlib.oauth2 import Server
44

5-
from ..oauth2_validators import OAuth2Validator
5+
from ..settings import oauth2_settings
66
from .mixins import ProtectedResourceMixin, ScopedResourceMixin, ReadWriteScopedResourceMixin
77

88

@@ -11,7 +11,7 @@ class ProtectedResourceView(ProtectedResourceMixin, View):
1111
Generic view protecting resources by providing OAuth2 authentication out of the box
1212
"""
1313
server_class = Server
14-
validator_class = OAuth2Validator
14+
validator_class = oauth2_settings.OAUTH2_VALIDATOR_CLASS
1515

1616

1717
class ScopedProtectedResourceView(ScopedResourceMixin, ProtectedResourceView):

0 commit comments

Comments
 (0)