@@ -108,23 +108,25 @@ def __init__(self, config=None, identity_cache=None, state_cache=None,
108
108
else :
109
109
self .state = state_cache
110
110
111
- # Handle values which are False by default
112
- self .logout_requests_signed = False
113
- self .allow_unsolicited = False
114
- self .authn_requests_signed = False
115
- self .want_assertions_signed = False
116
- for param in ["allow_unsolicited" , "authn_requests_signed" ,
117
- "logout_requests_signed" , "want_assertions_signed" ]:
118
- v = self .config .getattr (param , "sp" )
119
- if v is True or v == 'true' :
120
- setattr (self , param , True )
121
-
122
- # Handle values which are True by default
123
- self .want_response_signed = True
124
- for param in ["want_assertions_signed" ]:
125
- v = self .config .getattr (param , "sp" )
126
- if v is False or v == 'false' :
127
- setattr (self , param , False )
111
+ attribute_defaults = {
112
+ "logout_requests_signed" : False ,
113
+ "allow_unsolicited" : False ,
114
+ "authn_requests_signed" : False ,
115
+ "want_assertions_signed" : False ,
116
+ "want_response_signed" : True ,
117
+ }
118
+
119
+ for attr , val_default in attribute_defaults .items ():
120
+ val_config = self .config .getattr (attr , "sp" )
121
+ if val_config is None :
122
+ val = val_default
123
+ else :
124
+ val = val_config
125
+
126
+ if val == 'true' :
127
+ val = True
128
+
129
+ setattr (self , attr , val )
128
130
129
131
if self .entity_type == "sp" and not any ([self .want_assertions_signed ,
130
132
self .want_response_signed ]):
0 commit comments