summaryrefslogtreecommitdiff
path: root/src/saml2/assertion.py
diff options
context:
space:
mode:
authorHans Hörberg <hans.horberg@umu.se>2015-03-16 16:44:00 +0100
committerHans Hörberg <hans.horberg@umu.se>2015-03-16 16:44:00 +0100
commit15119f04dc49eea0bc91c7d43224843ab9b25899 (patch)
tree27c7f78428e2f0bc71a77a748f1bc63b22d7f971 /src/saml2/assertion.py
parent6e0acc8997b8290ee7a03fbb3aa5a19ce1158e03 (diff)
downloadpysaml2-15119f04dc49eea0bc91c7d43224843ab9b25899.tar.gz
Updated pysaml2 to support PEFIM.
Added encrypted assertions with self contained namespaces in the advice element.
Diffstat (limited to 'src/saml2/assertion.py')
-rw-r--r--src/saml2/assertion.py41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/saml2/assertion.py b/src/saml2/assertion.py
index 0e66eb22..9a35e116 100644
--- a/src/saml2/assertion.py
+++ b/src/saml2/assertion.py
@@ -666,7 +666,7 @@ class Assertion(dict):
name_id, attrconvs, policy, issuer, authn_class=None,
authn_auth=None, authn_decl=None, encrypt=None,
sec_context=None, authn_decl_ref=None, authn_instant="",
- subject_locality="", authn_statem=None):
+ subject_locality="", authn_statem=None, add_subject=True):
""" Construct the Assertion
:param sp_entity_id: The entityid of the SP
@@ -722,22 +722,29 @@ class Assertion(dict):
else:
_authn_statement = None
- _ass = assertion_factory(
- issuer=issuer,
- conditions=conds,
- subject=factory(
- saml.Subject,
- name_id=name_id,
- subject_confirmation=[factory(
- saml.SubjectConfirmation,
- method=saml.SCM_BEARER,
- subject_confirmation_data=factory(
- saml.SubjectConfirmationData,
- in_response_to=in_response_to,
- recipient=consumer_url,
- not_on_or_after=policy.not_on_or_after(sp_entity_id)))]
- ),
- )
+ if not add_subject:
+ _ass = assertion_factory(
+ issuer=issuer,
+ conditions=conds,
+ subject=None
+ )
+ else:
+ _ass = assertion_factory(
+ issuer=issuer,
+ conditions=conds,
+ subject=factory(
+ saml.Subject,
+ name_id=name_id,
+ subject_confirmation=[factory(
+ saml.SubjectConfirmation,
+ method=saml.SCM_BEARER,
+ subject_confirmation_data=factory(
+ saml.SubjectConfirmationData,
+ in_response_to=in_response_to,
+ recipient=consumer_url,
+ not_on_or_after=policy.not_on_or_after(sp_entity_id)))]
+ ),
+ )
if _authn_statement:
_ass.authn_statement = [_authn_statement]