Skip to content

Commit ffd68b8

Browse files
committed
Update utils to reflect the split between session/authorization audiences
1 parent 9afd975 commit ffd68b8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rest_framework_sso/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ def encode_jwt_token(payload):
4141
raise RuntimeError('IDENTITY must be specified in settings')
4242

4343
if not payload.get('aud'):
44-
if api_settings.SESSION_AUDIENCE is not None:
44+
if payload.get('type') == 'session' and api_settings.SESSION_AUDIENCE is not None:
4545
payload['aud'] = api_settings.SESSION_AUDIENCE
46+
elif payload.get('type') == 'auth' and api_settings.AUTHORIZATION_AUDIENCE is not None:
47+
payload['aud'] = api_settings.AUTHORIZATION_AUDIENCE
4648
elif api_settings.IDENTITY is not None:
4749
payload['aud'] = [api_settings.IDENTITY]
4850
else:

0 commit comments

Comments
 (0)