Skip to content

Commit a630f70

Browse files
only send assertion_info when the method is bearer
1 parent f52eca2 commit a630f70

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

djangosaml2/views.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
StatusNoAuthnContext, StatusRequestDenied,
4343
UnsolicitedResponse)
4444
from saml2.s_utils import UnsupportedBinding
45+
from saml2.saml import SCM_BEARER
4546
from saml2.samlp import AuthnRequest
4647
from saml2.sigver import MissingKey
4748
from saml2.validate import ResponseLifetimeExceed, ToEarly
@@ -56,6 +57,7 @@
5657
get_idp_sso_supported_bindings, get_location,
5758
validate_referral_url)
5859

60+
5961
logger = logging.getLogger('djangosaml2')
6062

6163

@@ -422,9 +424,12 @@ def post(self, request, attribute_mapping=None, create_unknown_user=None):
422424

423425
# assertion_info
424426
assertion = response.assertion
425-
subject_confirmation_data = [sc.subject_confirmation_data for sc in assertion.subject.subject_confirmation]
426-
subject_nooa = [scd.not_on_or_after if scd else None for scd in subject_confirmation_data]
427-
assertion_info = {'assertion_id': assertion.id, 'not_on_or_after': subject_nooa}
427+
assertion_info = {}
428+
for sc in assertion.subject.subject_confirmation:
429+
if sc.method == SCM_BEARER:
430+
assertion_not_on_or_after = sc.subject_confirmation_data.not_on_or_after
431+
assertion_info = {'assertion_id': assertion.id, 'not_on_or_after': assertion_not_on_or_after}
432+
break
428433

429434
if callable(attribute_mapping):
430435
attribute_mapping = attribute_mapping()

0 commit comments

Comments
 (0)