本文整理汇总了Python中onelogin.saml2.logout_request.OneLogin_Saml2_Logout_Request.get_session_indexes方法的典型用法代码示例。如果您正苦于以下问题:Python OneLogin_Saml2_Logout_Request.get_session_indexes方法的具体用法?Python OneLogin_Saml2_Logout_Request.get_session_indexes怎么用?Python OneLogin_Saml2_Logout_Request.get_session_indexes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类onelogin.saml2.logout_request.OneLogin_Saml2_Logout_Request
的用法示例。
在下文中一共展示了OneLogin_Saml2_Logout_Request.get_session_indexes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testGetSessionIndexes
# 需要导入模块: from onelogin.saml2.logout_request import OneLogin_Saml2_Logout_Request [as 别名]
# 或者: from onelogin.saml2.logout_request.OneLogin_Saml2_Logout_Request import get_session_indexes [as 别名]
def testGetSessionIndexes(self):
"""
Tests the get_session_indexes of the OneLogin_Saml2_LogoutRequest
"""
request = self.file_contents(join(self.data_path, 'logout_requests', 'logout_request.xml'))
session_indexes = OneLogin_Saml2_Logout_Request.get_session_indexes(request)
self.assertEqual(len(session_indexes), 0)
dom = parseString(request)
session_indexes_2 = OneLogin_Saml2_Logout_Request.get_session_indexes(dom)
self.assertEqual(len(session_indexes_2), 0)
request_2 = self.file_contents(join(self.data_path, 'logout_requests', 'logout_request_with_sessionindex.xml'))
session_indexes_3 = OneLogin_Saml2_Logout_Request.get_session_indexes(request_2)
self.assertEqual(['_ac72a76526cb6ca19f8438e73879a0e6c8ae5131'], session_indexes_3)
示例2: testLogoutNameIDandSessionIndex
# 需要导入模块: from onelogin.saml2.logout_request import OneLogin_Saml2_Logout_Request [as 别名]
# 或者: from onelogin.saml2.logout_request.OneLogin_Saml2_Logout_Request import get_session_indexes [as 别名]
def testLogoutNameIDandSessionIndex(self):
"""
Tests the logout method of the OneLogin_Saml2_Auth class
Case nameID and sessionIndex as parameters.
"""
settings_info = self.loadSettingsJSON()
request_data = self.get_request()
auth = OneLogin_Saml2_Auth(request_data, old_settings=settings_info)
name_id = 'name_id_example'
session_index = 'session_index_example'
target_url = auth.logout(name_id=name_id, session_index=session_index)
parsed_query = parse_qs(urlparse(target_url)[4])
slo_url = settings_info['idp']['singleLogoutService']['url']
self.assertIn(slo_url, target_url)
self.assertIn('SAMLRequest', parsed_query)
logout_request = OneLogin_Saml2_Utils.decode_base64_and_inflate(parsed_query['SAMLRequest'][0])
name_id_from_request = OneLogin_Saml2_Logout_Request.get_nameid(logout_request)
sessions_index_in_request = OneLogin_Saml2_Logout_Request.get_session_indexes(logout_request)
self.assertIn(session_index, sessions_index_in_request)
self.assertEqual(name_id, name_id_from_request)