Skip to content

Commit 63d3165

Browse files
authored
Merge pull request #415 from skoranda/name_id_format_none
Enable deployer to signal no name format in authn request
2 parents b7b79c9 + 0d2e0ba commit 63d3165

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/saml2/client_base.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,21 @@ def create_authn_request(self, destination, vorg="", scoping=None,
304304
if nameid_format is None:
305305
nameid_format = self.config.getattr("name_id_format", "sp")
306306

307+
# If no nameid_format has been set in the configuration
308+
# or passed in then transient is the default.
307309
if nameid_format is None:
308310
nameid_format = NAMEID_FORMAT_TRANSIENT
311+
312+
# If a list has been configured or passed in choose the
313+
# first since NameIDPolicy can only have one format specified.
309314
elif isinstance(nameid_format, list):
310-
# NameIDPolicy can only have one format specified
311315
nameid_format = nameid_format[0]
312316

317+
# Allow a deployer to signal that no format should be specified
318+
# in the NameIDPolicy by passing in or configuring the string 'None'.
319+
elif nameid_format == 'None':
320+
nameid_format = None
321+
313322
name_id_policy = samlp.NameIDPolicy(allow_create=allow_create,
314323
format=nameid_format)
315324

0 commit comments

Comments
 (0)