@@ -61,6 +61,8 @@ def __init__(self, request_data, old_settings=None, custom_base_path=None):
6161 self .__errors = []
6262 self .__error_reason = None
6363 self .__last_request_id = None
64+ self .__last_message_id = None
65+ self .__last_assertion_id = None
6466 self .__last_request = None
6567 self .__last_response = None
6668
@@ -104,6 +106,8 @@ def process_response(self, request_id=None):
104106 self .__nameid_format = response .get_nameid_format ()
105107 self .__session_index = response .get_session_index ()
106108 self .__session_expiration = response .get_session_not_on_or_after ()
109+ self .__last_message_id = response .get_id ()
110+ self .__last_assertion_id = response .get_assertion_id ()
107111 self .__authenticated = True
108112
109113 else :
@@ -143,8 +147,10 @@ def process_slo(self, keep_local_session=False, request_id=None, delete_session_
143147 self .__error_reason = logout_response .get_error ()
144148 elif logout_response .get_status () != OneLogin_Saml2_Constants .STATUS_SUCCESS :
145149 self .__errors .append ('logout_not_success' )
146- elif not keep_local_session :
147- OneLogin_Saml2_Utils .delete_local_session (delete_session_cb )
150+ else :
151+ self .__last_message_id = logout_response .id
152+ if not keep_local_session :
153+ OneLogin_Saml2_Utils .delete_local_session (delete_session_cb )
148154
149155 elif get_data and 'SAMLRequest' in get_data :
150156 logout_request = OneLogin_Saml2_Logout_Request (self .__settings , get_data ['SAMLRequest' ])
@@ -160,6 +166,7 @@ def process_slo(self, keep_local_session=False, request_id=None, delete_session_
160166 OneLogin_Saml2_Utils .delete_local_session (delete_session_cb )
161167
162168 in_response_to = logout_request .id
169+ self .__last_message_id = logout_request .id
163170 response_builder = OneLogin_Saml2_Logout_Response (self .__settings )
164171 response_builder .build (in_response_to )
165172 self .__last_response = response_builder .get_xml ()
@@ -286,6 +293,20 @@ def get_last_request_id(self):
286293 """
287294 return self .__last_request_id
288295
296+ def get_last_message_id (self ):
297+ """
298+ :returns: The ID of the last Response SAML message processed.
299+ :rtype: string
300+ """
301+ return self .__last_message_id
302+
303+ def get_last_assertion_id (self ):
304+ """
305+ :returns: The ID of the last assertion processed.
306+ :rtype: string
307+ """
308+ return self .__last_assertion_id
309+
289310 def login (self , return_to = None , force_authn = False , is_passive = False , set_nameid_policy = True ):
290311 """
291312 Initiates the SSO process.
0 commit comments