Skip to content

Commit 80367ae

Browse files
committed
Reformat if statement to always be an assignment
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent 919a288 commit 80367ae

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/satosa/frontends/saml2.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -308,24 +308,21 @@ def _handle_authn_response(self, context, internal_response, idp):
308308
ava.pop(k, None)
309309

310310
nameid_value = internal_response.subject_id
311+
nameid_format = subject_type_to_saml_nameid_format(
312+
internal_response.subject_type
313+
)
311314

312315
# If the backend did not receive a SAML <NameID> and so
313316
# name_id is set to None then do not create a NameID instance.
314317
# Instead pass None as the name name_id to the IdP server
315318
# instance and it will use its configured policy to construct
316319
# a <NameID>, with the default to create a transient <NameID>.
317-
if nameid_value is None:
318-
name_id = None
319-
else:
320-
nameid_format = subject_type_to_saml_nameid_format(
321-
internal_response.subject_type
322-
)
323-
name_id = NameID(
324-
text=nameid_value,
325-
format=nameid_format,
326-
sp_name_qualifier=None,
327-
name_qualifier=None,
328-
)
320+
name_id = None if not nameid_value else NameID(
321+
text=nameid_value,
322+
format=nameid_format,
323+
sp_name_qualifier=None,
324+
name_qualifier=None,
325+
)
329326

330327
dbgmsg = "returning attributes %s" % json.dumps(ava)
331328
satosa_logging(logger, logging.DEBUG, dbgmsg, context.state)

0 commit comments

Comments
 (0)