【发布时间】:2015-10-27 06:11:38
【问题描述】:
这是在 IDP 和 SP 之间交换 SAML 断言的代码的 sn-p,我可以从 IDP 获取 SAML 断言,但是在 SP 端从 IDP 获取 SAML 断言的代码不起作用。
def exchange_assertion(self):
"""Send assertion to a SP."""
# sp[u'sp_url'] = http://localhost/Shibboleth.sso/SAML2/ECP
response = self.session.post(
sp[u'sp_url'],
headers={'Content-Type': 'application/vnd.paos+xml'},
data=self.assertion,
authenticated=False,
redirect=False)
# the status code is 302, so I assume it's okay so far.
self._check_response(response)
# sp[u'auth_url'] is url of which points to SP where it expects
# the saml assertion can be fetched from the context, but
# it doesn't unfortunately.
r = self._handle_http_302_ecp_redirect(self.session, response, sp[u'auth_url'],
method='GET',
headers={'Content-Type':
'application/vnd.paos+xml'})
def _handle_http_302_ecp_redirect(self, session, response, location, method, **kwargs):
return session.get(location, authenticated=False, **kwargs)
我被卡住的地方是无法从上下文 ['environment'] 中获取 saml 断言。那么,这里出了什么问题?提前感谢您的任何建议。
【问题讨论】:
标签: saml federated-identity service-provider