Skip to content

Commit 3c19397

Browse files
Fixes tox tests
1 parent 2c5cf28 commit 3c19397

File tree

3 files changed

+5
-35
lines changed

3 files changed

+5
-35
lines changed

oidc_provider/lib/endpoints/token.py

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
UserAuthError,
1212
)
1313
from oidc_provider.lib.utils.oauth2 import extract_client_auth
14-
from oidc_provider.lib.utils.token import (
15-
create_id_token,
16-
create_token,
17-
)
14+
from oidc_provider.lib.utils.token import create_token
1815
from oidc_provider.models import (
1916
Client,
2017
Code,
@@ -160,6 +157,7 @@ def create_access_token_response_dic(self):
160157
)
161158

162159
id_token_dic = create_id_token_hook(
160+
token=token,
163161
user=self.user,
164162
aud=self.client.client_id,
165163
nonce='self.code.nonce',
@@ -269,35 +267,6 @@ def create_refresh_response_dic(self):
269267

270268
return dic
271269

272-
def create_access_token_response_dic(self):
273-
# See https://tools.ietf.org/html/rfc6749#section-4.3
274-
275-
token = create_token(
276-
self.user,
277-
self.client,
278-
self.params['scope'].split(' '))
279-
280-
id_token_dic = create_id_token(
281-
token=token,
282-
user=self.user,
283-
aud=self.client.client_id,
284-
nonce='self.code.nonce',
285-
at_hash=token.at_hash,
286-
request=self.request,
287-
scope=token.scope,
288-
)
289-
290-
token.id_token = id_token_dic
291-
token.save()
292-
293-
return {
294-
'access_token': token.access_token,
295-
'refresh_token': token.refresh_token,
296-
'expires_in': settings.get('OIDC_TOKEN_EXPIRE'),
297-
'token_type': 'bearer',
298-
'id_token': encode_id_token(id_token_dic, token.client),
299-
}
300-
301270
def create_client_credentials_response_dic(self):
302271
# See https://tools.ietf.org/html/rfc6749#section-4.4.3
303272

oidc_provider/lib/utils/oauth2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def extract_access_token(request):
2121
"""
2222
auth_header = request.META.get('HTTP_AUTHORIZATION', '')
2323

24-
if re.compile('^[Bb]earer\s{1}.+$').match(auth_header):
24+
if re.compile(r'^[Bb]earer\s{1}.+$').match(auth_header):
2525
access_token = auth_header.split()[1]
2626
else:
2727
access_token = request.GET.get('access_token', '')
@@ -39,7 +39,7 @@ def extract_client_auth(request):
3939
"""
4040
auth_header = request.META.get('HTTP_AUTHORIZATION', '')
4141

42-
if re.compile('^Basic\s{1}.+$').match(auth_header):
42+
if re.compile(r'^Basic\s{1}.+$').match(auth_header):
4343
b64_user_pass = auth_header.split()[1]
4444
try:
4545
user_pass = b64decode(b64_user_pass).decode('utf-8').split(':')

oidc_provider/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ def OIDC_IDTOKEN_ENCODE_HOOK(self):
154154
"""
155155
return 'oidc_provider.lib.utils.token.encode_id_token'
156156

157+
@property
157158
def OIDC_INTROSPECTION_PROCESSING_HOOK(self):
158159
"""
159160
OPTIONAL. A string with the location of your function.

0 commit comments

Comments
 (0)