diff options
author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2020-12-08 00:26:41 +0200 |
---|---|---|
committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2020-12-08 00:26:41 +0200 |
commit | b8117998bf6fb1f516b6220fc4462efab17e7667 (patch) | |
tree | 3bcbce7f57673e695a6b0e4c07bde4f0663a0d7b | |
parent | dbebbd4434a96e83a30be42221a9f2e2897a1cda (diff) | |
download | pysaml2-b8117998bf6fb1f516b6220fc4462efab17e7667.tar.gz |
Calculate entity configurations and then choose
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
-rw-r--r-- | src/saml2/entity.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/saml2/entity.py b/src/saml2/entity.py index 7fd18da9..71e9ecfb 100644 --- a/src/saml2/entity.py +++ b/src/saml2/entity.py @@ -151,13 +151,12 @@ class Entity(HTTPBase): self.config.getattr('digest_algorithm') or def_sig.get_digest_alg() ) - sign_config = ( - self.config.getattr("authn_requests_signed", "sp") - if self.entity_type == "sp" - else self.config.getattr("sign_response", "idp") - if self.entity_type == "idp" - else False - ) + + sign_config_per_entity_type = { + 'sp': self.config.getattr("authn_requests_signed", "sp"), + 'idp': self.config.getattr("sign_response", "idp"), + } + sign_config = sign_config_per_entity_type.get(self.entity_type, False) self.should_sign = sign_config for item in ["cert_file", "key_file", "ca_certs"]: |