本文整理汇总了Python中onelogin.saml2.idp_metadata_parser.OneLogin_Saml2_IdPMetadataParser.get_metadata方法的典型用法代码示例。如果您正苦于以下问题:Python OneLogin_Saml2_IdPMetadataParser.get_metadata方法的具体用法?Python OneLogin_Saml2_IdPMetadataParser.get_metadata怎么用?Python OneLogin_Saml2_IdPMetadataParser.get_metadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类onelogin.saml2.idp_metadata_parser.OneLogin_Saml2_IdPMetadataParser
的用法示例。
在下文中一共展示了OneLogin_Saml2_IdPMetadataParser.get_metadata方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testGetMetadata
# 需要导入模块: from onelogin.saml2.idp_metadata_parser import OneLogin_Saml2_IdPMetadataParser [as 别名]
# 或者: from onelogin.saml2.idp_metadata_parser.OneLogin_Saml2_IdPMetadataParser import get_metadata [as 别名]
def testGetMetadata(self):
"""
Tests the get_metadata method of the OneLogin_Saml2_IdPMetadataParser
"""
with self.assertRaises(Exception):
data = OneLogin_Saml2_IdPMetadataParser.get_metadata('http://google.es')
data = OneLogin_Saml2_IdPMetadataParser.get_metadata('https://www.testshib.org/metadata/testshib-providers.xml')
self.assertTrue(data is not None and data is not {})
示例2: testGetMetadata
# 需要导入模块: from onelogin.saml2.idp_metadata_parser import OneLogin_Saml2_IdPMetadataParser [as 别名]
# 或者: from onelogin.saml2.idp_metadata_parser.OneLogin_Saml2_IdPMetadataParser import get_metadata [as 别名]
def testGetMetadata(self):
"""
Tests the get_metadata method of the OneLogin_Saml2_IdPMetadataParser
"""
with self.assertRaises(Exception):
data = OneLogin_Saml2_IdPMetadataParser.get_metadata('http://google.es')
try:
data = OneLogin_Saml2_IdPMetadataParser.get_metadata('https://www.testshib.org/metadata/testshib-providers.xml')
except URLError:
data = self.file_contents(join(self.data_path, 'metadata', 'testshib-providers.xml'))
self.assertTrue(data is not None and data is not {})
示例3: test_parse_testshib_required_binding_sso_post
# 需要导入模块: from onelogin.saml2.idp_metadata_parser import OneLogin_Saml2_IdPMetadataParser [as 别名]
# 或者: from onelogin.saml2.idp_metadata_parser.OneLogin_Saml2_IdPMetadataParser import get_metadata [as 别名]
def test_parse_testshib_required_binding_sso_post(self):
"""
Test with testshib metadata.
Especially test extracting SSO with POST binding.
"""
expected_settings_json = """
{
"sp": {
"NameIDFormat": "urn:mace:shibboleth:1.0:nameIdentifier"
},
"idp": {
"entityId": "https://idp.testshib.org/idp/shibboleth",
"singleSignOnService": {
"url": "https://idp.testshib.org/idp/profile/SAML2/POST/SSO",
"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
}
}
}
"""
try:
xmldoc = OneLogin_Saml2_IdPMetadataParser.get_metadata(
'https://www.testshib.org/metadata/testshib-providers.xml')
except URLError:
xmldoc = self.file_contents(join(self.data_path, 'metadata', 'testshib-providers.xml'))
# Parse, require POST binding.
settings = OneLogin_Saml2_IdPMetadataParser.parse(
xmldoc,
required_sso_binding=OneLogin_Saml2_Constants.BINDING_HTTP_POST
)
expected_settings = json.loads(expected_settings_json)
self.assertEqual(expected_settings, settings)
示例4: test_parse_testshib_required_binding_sso_post
# 需要导入模块: from onelogin.saml2.idp_metadata_parser import OneLogin_Saml2_IdPMetadataParser [as 别名]
# 或者: from onelogin.saml2.idp_metadata_parser.OneLogin_Saml2_IdPMetadataParser import get_metadata [as 别名]
def test_parse_testshib_required_binding_sso_post(self):
"""
Test with testshib metadata.
Especially test extracting SSO with POST binding.
"""
expected_settings_json = """
{
"sp": {
"NameIDFormat": "urn:mace:shibboleth:1.0:nameIdentifier"
},
"idp": {
"x509cert": "MIIDAzCCAeugAwIBAgIVAPX0G6LuoXnKS0Muei006mVSBXbvMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNVBAMMEGlkcC50ZXN0c2hpYi5vcmcwHhcNMTYwODIzMjEyMDU0WhcNMzYwODIzMjEyMDU0WjAbMRkwFwYDVQQDDBBpZHAudGVzdHNoaWIub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg9C4J2DiRTEhJAWzPt1S3ryhm3M2P3hPpwJwvt2q948vdTUxhhvNMuc3M3S4WNh6JYBs53R+YmjqJAII4ShMGNEmlGnSVfHorex7IxikpuDPKV3SNf28mCAZbQrX+hWA+ann/uifVzqXktOjs6DdzdBnxoVhniXgC8WCJwKcx6JO/hHsH1rG/0DSDeZFpTTcZHj4S9MlLNUtt5JxRzV/MmmB3ObaX0CMqsSWUOQeE4nylSlp5RWHCnx70cs9kwz5WrflnbnzCeHU2sdbNotBEeTHot6a2cj/pXlRJIgPsrL/4VSicPZcGYMJMPoLTJ8mdy6mpR6nbCmP7dVbCIm/DQIDAQABoz4wPDAdBgNVHQ4EFgQUUfaDa2mPi24x09yWp1OFXmZ2GPswGwYDVR0RBBQwEoIQaWRwLnRlc3RzaGliLm9yZzANBgkqhkiG9w0BAQsFAAOCAQEASKKgqTxhqBzROZ1eVy++si+eTTUQZU4+8UywSKLia2RattaAPMAcXUjO+3cYOQXLVASdlJtt+8QPdRkfp8SiJemHPXC8BES83pogJPYEGJsKo19l4XFJHPnPy+Dsn3mlJyOfAa8RyWBS80u5lrvAcr2TJXt9fXgkYs7BOCigxtZoR8flceGRlAZ4p5FPPxQR6NDYb645jtOTMVr3zgfjP6Wh2dt+2p04LG7ENJn8/gEwtXVuXCsPoSCDx9Y0QmyXTJNdV1aB0AhORkWPlFYwp+zOyOIR+3m1+pqWFpn0eT/HrxpdKa74FA3R2kq4R7dXe4G0kUgXTdqXMLRKhDgdmA==",
"entityId": "https://idp.testshib.org/idp/shibboleth",
"singleSignOnService": {
"url": "https://idp.testshib.org/idp/profile/SAML2/POST/SSO",
"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
}
}
}
"""
try:
xmldoc = OneLogin_Saml2_IdPMetadataParser.get_metadata(
'https://idp.testshib.org/idp/shibboleth')
except URLError:
xmldoc = self.file_contents(join(self.data_path, 'metadata', 'testshib-providers.xml'))
# Parse, require POST binding.
settings = OneLogin_Saml2_IdPMetadataParser.parse(
xmldoc,
required_sso_binding=OneLogin_Saml2_Constants.BINDING_HTTP_POST
)
expected_settings = json.loads(expected_settings_json)
self.assertEqual(expected_settings, settings)
示例5: test_parse_testshib_required_binding_sso_redirect
# 需要导入模块: from onelogin.saml2.idp_metadata_parser import OneLogin_Saml2_IdPMetadataParser [as 别名]
# 或者: from onelogin.saml2.idp_metadata_parser.OneLogin_Saml2_IdPMetadataParser import get_metadata [as 别名]
def test_parse_testshib_required_binding_sso_redirect(self):
"""
Test with testshib metadata.
Especially test extracting SSO with REDIRECT binding.
Note that the testshib metadata does not contain an SLO specification
in the first <IDPSSODescriptor> tag.
"""
expected_settings_json = """
{
"sp": {
"NameIDFormat": "urn:mace:shibboleth:1.0:nameIdentifier"
},
"idp": {
"entityId": "https://idp.testshib.org/idp/shibboleth",
"singleSignOnService": {
"url": "https://idp.testshib.org/idp/profile/SAML2/Redirect/SSO",
"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
}
}
}
"""
try:
xmldoc = OneLogin_Saml2_IdPMetadataParser.get_metadata(
'https://www.testshib.org/metadata/testshib-providers.xml')
except URLError:
xmldoc = self.file_contents(join(self.data_path, 'metadata', 'testshib-providers.xml'))
# Parse, require SSO REDIRECT binding, implicitly.
settings1 = OneLogin_Saml2_IdPMetadataParser.parse(xmldoc)
# Parse, require SSO REDIRECT binding, explicitly.
settings2 = OneLogin_Saml2_IdPMetadataParser.parse(
xmldoc,
required_sso_binding=OneLogin_Saml2_Constants.BINDING_HTTP_REDIRECT
)
expected_settings = json.loads(expected_settings_json)
self.assertEqual(expected_settings, settings1)
self.assertEqual(expected_settings, settings2)