4
4
from oauthlib .common import urlencode , urlencoded , quote
5
5
6
6
from .exceptions import OAuthToolkitError , FatalClientError
7
- from .oauth2_validators import OAuth2Validator
7
+ from .settings import oauth2_settings
8
8
from .compat import urlparse , urlunparse
9
9
10
10
@@ -16,7 +16,7 @@ def __init__(self, server=None):
16
16
"""
17
17
:params server: An instance of oauthlib.oauth2.Server class
18
18
"""
19
- self .server = server or oauth2 .Server (OAuth2Validator ())
19
+ self .server = server or oauth2 .Server (oauth2_settings . OAUTH2_VALIDATOR_CLASS ())
20
20
21
21
def _get_escaped_full_path (self , request ):
22
22
"""
@@ -80,7 +80,7 @@ def create_authorization_response(self, request, scopes, credentials, allow):
80
80
if not allow :
81
81
raise oauth2 .AccessDeniedError ()
82
82
83
- # add current user to credentials. this will be used by OAuth2Validator
83
+ # add current user to credentials. this will be used by OAUTH2_VALIDATOR_CLASS
84
84
credentials ['user' ] = request .user
85
85
86
86
headers , body , status = self .server .create_authorization_response (
@@ -126,8 +126,7 @@ def get_oauthlib_core():
126
126
Utility function that take a request and returns an instance of
127
127
`oauth2_provider.backends.OAuthLibCore`
128
128
"""
129
- from oauth2_provider .oauth2_validators import OAuth2Validator
130
129
from oauthlib .oauth2 import Server
131
130
132
- server = Server (OAuth2Validator ())
131
+ server = Server (oauth2_settings . OAUTH2_VALIDATOR_CLASS ())
133
132
return OAuthLibCore (server )
0 commit comments