Skip to content

Commit b811799

Browse files
committed
Calculate entity configurations and then choose
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent dbebbd4 commit b811799

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/saml2/entity.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,12 @@ def __init__(self, entity_type, config=None, config_file="",
151151
self.config.getattr('digest_algorithm')
152152
or def_sig.get_digest_alg()
153153
)
154-
sign_config = (
155-
self.config.getattr("authn_requests_signed", "sp")
156-
if self.entity_type == "sp"
157-
else self.config.getattr("sign_response", "idp")
158-
if self.entity_type == "idp"
159-
else False
160-
)
154+
155+
sign_config_per_entity_type = {
156+
'sp': self.config.getattr("authn_requests_signed", "sp"),
157+
'idp': self.config.getattr("sign_response", "idp"),
158+
}
159+
sign_config = sign_config_per_entity_type.get(self.entity_type, False)
161160
self.should_sign = sign_config
162161

163162
for item in ["cert_file", "key_file", "ca_certs"]:

0 commit comments

Comments
 (0)