@@ -709,11 +709,10 @@ def authn_statement(authn_class=None, authn_auth=None,
709
709
return res
710
710
711
711
712
- def do_subject_confirmation (policy , sp_entity_id , key_info = None , ** treeargs ):
712
+ def do_subject_confirmation (not_on_or_after , key_info = None , ** treeargs ):
713
713
"""
714
714
715
- :param policy: Policy instance
716
- :param sp_entity_id: The entityid of the SP
715
+ :param not_on_or_after: not_on_or_after policy
717
716
:param subject_confirmation_method: How was the subject confirmed
718
717
:param address: The network address/location from which an attesting entity
719
718
can present the assertion.
@@ -730,21 +729,21 @@ def do_subject_confirmation(policy, sp_entity_id, key_info=None, **treeargs):
730
729
_sc = factory (saml .SubjectConfirmation , ** treeargs )
731
730
732
731
_scd = _sc .subject_confirmation_data
733
- _scd .not_on_or_after = policy . not_on_or_after ( sp_entity_id )
732
+ _scd .not_on_or_after = not_on_or_after
734
733
735
734
if _sc .method == saml .SCM_HOLDER_OF_KEY :
736
735
_scd .add_extension_element (key_info )
737
736
738
737
return _sc
739
738
740
739
741
- def do_subject (policy , sp_entity_id , name_id , ** farg ):
740
+ def do_subject (not_on_or_after , name_id , ** farg ):
742
741
specs = farg ['subject_confirmation' ]
743
742
744
743
if isinstance (specs , list ):
745
- res = [do_subject_confirmation (policy , sp_entity_id , ** s ) for s in specs ]
744
+ res = [do_subject_confirmation (not_on_or_after , ** s ) for s in specs ]
746
745
else :
747
- res = [do_subject_confirmation (policy , sp_entity_id , ** specs )]
746
+ res = [do_subject_confirmation (not_on_or_after , ** specs )]
748
747
749
748
return factory (saml .Subject , name_id = name_id , subject_confirmation = res )
750
749
@@ -784,13 +783,11 @@ def construct(self, sp_entity_id, attrconvs, policy, issuer, farg,
784
783
:return: An Assertion instance
785
784
"""
786
785
787
- if policy :
788
- _name_format = policy .get_name_form (sp_entity_id )
789
- else :
790
- _name_format = NAME_FORMAT_URI
786
+ _name_format = policy .get_name_form (sp_entity_id )
791
787
792
- attr_statement = saml .AttributeStatement (attribute = from_local (
793
- attrconvs , self , _name_format ))
788
+ attr_statement = saml .AttributeStatement (
789
+ attribute = from_local (attrconvs , self , _name_format )
790
+ )
794
791
795
792
if encrypt == "attributes" :
796
793
for attr in attr_statement .attribute :
@@ -816,11 +813,10 @@ def construct(self, sp_entity_id, attrconvs, policy, issuer, farg,
816
813
else :
817
814
_authn_statement = None
818
815
819
- subject = do_subject (policy , sp_entity_id , name_id ,
820
- ** farg ['subject' ])
821
-
822
- _ass = assertion_factory (issuer = issuer , conditions = conds ,
823
- subject = subject )
816
+ subject = do_subject (
817
+ policy .not_on_or_after (sp_entity_id ), name_id , ** farg ['subject' ]
818
+ )
819
+ _ass = assertion_factory (issuer = issuer , conditions = conds , subject = subject )
824
820
825
821
if _authn_statement :
826
822
_ass .authn_statement = [_authn_statement ]
0 commit comments