|
10 | 10 | """ |
11 | 11 |
|
12 | 12 | from onelogin.saml2 import compat |
| 13 | +from onelogin.saml2.constants import OneLogin_Saml2_Constants |
13 | 14 | from onelogin.saml2.utils import OneLogin_Saml2_Utils, OneLogin_Saml2_ValidationError |
14 | 15 | from onelogin.saml2.xml_templates import OneLogin_Saml2_Templates |
15 | 16 | from onelogin.saml2.xml_utils import OneLogin_Saml2_XML |
@@ -152,27 +153,28 @@ def _query(self, query): |
152 | 153 | """ |
153 | 154 | return OneLogin_Saml2_XML.query(self.document, query) |
154 | 155 |
|
155 | | - def build(self, in_response_to): |
| 156 | + def build(self, in_response_to, status=OneLogin_Saml2_Constants.STATUS_SUCCESS): |
156 | 157 | """ |
157 | 158 | Creates a Logout Response object. |
158 | 159 | :param in_response_to: InResponseTo value for the Logout Response. |
159 | 160 | :type in_response_to: string |
| 161 | + :param: status: The status of the response |
| 162 | + :type: status: string |
160 | 163 | """ |
161 | 164 | sp_data = self._settings.get_sp_data() |
162 | 165 |
|
163 | 166 | self.id = self._generate_request_id() |
164 | 167 |
|
165 | 168 | issue_instant = OneLogin_Saml2_Utils.parse_time_to_SAML(OneLogin_Saml2_Utils.now()) |
166 | 169 |
|
167 | | - logout_response = OneLogin_Saml2_Templates.LOGOUT_RESPONSE % \ |
168 | | - { |
169 | | - 'id': self.id, |
170 | | - 'issue_instant': issue_instant, |
171 | | - 'destination': self._settings.get_idp_slo_response_url(), |
172 | | - 'in_response_to': in_response_to, |
173 | | - 'entity_id': sp_data['entityId'], |
174 | | - 'status': "urn:oasis:names:tc:SAML:2.0:status:Success" |
175 | | - } |
| 170 | + logout_response = OneLogin_Saml2_Templates.LOGOUT_RESPONSE % { |
| 171 | + "id": self.id, |
| 172 | + "issue_instant": issue_instant, |
| 173 | + "destination": self._settings.get_idp_slo_response_url(), |
| 174 | + "in_response_to": in_response_to, |
| 175 | + "entity_id": sp_data["entityId"], |
| 176 | + "status": status, |
| 177 | + } |
176 | 178 |
|
177 | 179 | self._logout_response = logout_response |
178 | 180 |
|
|
0 commit comments