|
3 | 3 | #
|
4 | 4 | DISABLE_WEAK_XMLSEC_ALGORITHMS = True # https://github.com/IdentityPython/pysaml2/pull/628
|
5 | 5 | ADD_XSD_DATE_TYPE = True # https://github.com/IdentityPython/pysaml2/pull/602
|
6 |
| -PATCH_RESPONSE_VERIFY = True # https://github.com/peppelinux/pysaml2/commit/8bdbbdf41ce63a37d3ba02c8f48a3dba0217d463 |
| 6 | +PATCH_RESPONSE_VERIFY = True # https://github.com/IdentityPython/pysaml2/pull/812 |
7 | 7 |
|
8 | 8 |
|
9 | 9 | def pysaml2_patch():
|
@@ -167,27 +167,28 @@ def _wrong_type_value(xsd, value):
|
167 | 167 | AttributeValueBase.set_text = set_text
|
168 | 168 |
|
169 | 169 | if PATCH_RESPONSE_VERIFY:
|
170 |
| - logger = logging.getLogger(__name__) |
| 170 | + logger = logging.getLogger(StatusResponse.__module__) |
171 | 171 |
|
172 | 172 | def _verify(self):
|
173 | 173 | if self.request_id and self.in_response_to and \
|
174 | 174 | self.in_response_to != self.request_id:
|
175 | 175 | logger.error("Not the id I expected: %s != %s",
|
176 | 176 | self.in_response_to, self.request_id)
|
177 | 177 | return None
|
| 178 | + |
178 | 179 | if self.response.version != "2.0":
|
179 |
| - _ver = float(self.response.version) |
180 |
| - if _ver < 2.0: |
| 180 | + if float(self.response.version) < 2.0: |
181 | 181 | raise RequestVersionTooLow()
|
182 | 182 | else:
|
183 | 183 | raise RequestVersionTooHigh()
|
184 | 184 |
|
185 |
| - destination = self.response.destination |
186 |
| - if self.asynchop and destination: |
187 |
| - # Destination must be present |
188 |
| - if destination not in self.return_addrs: |
| 185 | + if self.asynchop: |
| 186 | + if not getattr(self.response, 'destination'): |
| 187 | + logger.error("Invalid response destination in asynchop") |
| 188 | + return None |
| 189 | + elif self.response.destination not in self.return_addrs: |
189 | 190 | logger.error(
|
190 |
| - f"{destination} not in {self.return_addrs}" |
| 191 | + f"{self.response.destination} not in {self.return_addrs}" |
191 | 192 | )
|
192 | 193 | return None
|
193 | 194 |
|
|
0 commit comments