Skip to content

Commit 4d0923f

Browse files
eofsmasci
authored andcommitted
Allow selecting custom OAuthLibCore implementation
1 parent ac22c62 commit 4d0923f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

oauth2_provider/views/mixins.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ def get_validator_class(cls):
4646
else:
4747
return cls.validator_class
4848

49+
@classmethod
50+
def get_oauthlib_core_class(cls):
51+
"""
52+
Return the OAuthLibCore implementation class to use
53+
"""
54+
if cls.oauthlib_core_class is None:
55+
return OAuthLibCore
56+
else:
57+
return cls.oauthlib_core_class
58+
4959
@classmethod
5060
def get_server(cls):
5161
"""
@@ -63,7 +73,8 @@ def get_oauthlib_core(cls):
6373
"""
6474
if not hasattr(cls, '_oauthlib_core'):
6575
server = cls.get_server()
66-
cls._oauthlib_core = OAuthLibCore(server)
76+
core_class = cls.get_oauthlib_core_class()
77+
cls._oauthlib_core = core_class(server)
6778
return cls._oauthlib_core
6879

6980
def validate_authorization_request(self, request):

0 commit comments

Comments
 (0)