理解SimpleSAMLphp的ReturnTo重定向时遇到问题
问题描述:
尝试在simplesamlphp中设置重定向以使用户回到他们在发送身份验证之前尝试访问的页面。理解SimpleSAMLphp的ReturnTo重定向时遇到问题
我使用的ReturnTo选项:
$as->requireAuth(array("ReturnTo" => $returnURL, 'KeepPost' => FALSE));
随着远程-IDP设置像这样的元数据(剥离例如):
$metadata['sample'] = array(
'name' => 'sample',
'entityid' => 'https://sample.com/saml/module.php/saml/sp/metadata.php/sample',
'metadata-set' => 'saml20-idp-remote',
'SingleSignOnService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
'Location' => 'https://sample:port/idp/startSSO.ping?PartnerSpId=https://sample.com/saml/module.php/saml/sp/metadata.php/sample'
)
),
'keys' => array(...)
);
我需要通过一个参数“TARGET “插入上述元数据中的idp startSSO,但一直未能找到如何翻译要添加到此SSO网址上的”ReturnTo“选项。我还捕获/检查了SAML重定向xml,并且ReturnTo根本就没有在那里。有人知道怎么做吗?
答
试图建立在simplesamlphp重定向到用户返回到 他们试图访问该页面被发送到 验证之前。
使用没有任何选项的ReturnTo方法默认重定向到用户尝试访问的页面。
ReturnTo(串)
的URL,用户应后 认证退还。默认值是将用户返回到当前页面。
只需将此代码包含在需要验证的页面中即可。
require_once 'path/to/simplesamlphp/lib/_autoload.php';
$as = new SimpleSAML_Auth_Simple('default-sp');
$as->requireAuth();