我正在尝试设置一个 Web 应用程序(目前只是一个 index.php 文件),用户只有在通过 Microsoft Azure idp 登录后才能使用它。 当用户到达此页面时,会将他重定向到 Microsoft 登录页面。 到目前为止没问题,它可以工作。 但是一旦登录,我希望用户被重定向到我的 index.php 页面,但目前重定向是 https://my-web-site.com/simplesaml/www/module.php/saml/sp/ saml2-acs.php/default-sp 出现页面未找到错误。 我不明白如何/在哪里更改此重定向网址。
我填写了以下信息:
我正在运行的服务器使用 nginx 运行,我没有修改配置的权限。所以我没有在安装 simplesamlphp 的文档中进行第 6 步。
我的 index.php 与文档中的示例相同:
require_once('simplesaml/lib/_autoload.php');
$as = new \SimpleSAML\Auth\Simple('default-sp');
$as->requireAuth();
$attributes = $as->getAttributes();
print_r($attributes);
我虽然这是一个 ACS 重定向,所以在
'default-sp'
中的 authsources.php 中我添加了:
'AssertionConsumerService' => 'https://my-web-site/',
但什么都没有改变。
位于 https://my-web-site.com/simplesaml/www/ 的 SimpleSAMLphp 安装页面仅部分工作。所有 frontpage_*.php 都在工作,但功能将我发送到 403 Forbidden 或找不到页面,如:
PS:我从 SimpleSAMLphp 的本地 Wamp 安装将我的 idp 的 XML 转换为 SimpleSAMLphp 元数据,因为此功能在我的网站上不起作用。
如何在登录Microsoft Azure 后更改重定向?我一直在寻找几天,但找不到解决方案。如果不更改 nginx 配置,我是否遗漏了什么或不可能?
非常感谢您的帮助(在它让我发疯之前;)),谢谢。
您不需要更改该 URL(AssertionConsumerService),但您需要找出为什么您的 Apache 安装不能正确提供它。所以我认为这更像是一个 Apache 问题?也许 Apache 错误日志有一些关于为什么它不提供 SimpleSAMLphp 的 URL 的线索。
关于死循环,我会调查你是否正确设置了SimpleSAMLphp的SameSite选项。该文档有更多信息。
我有同样的问题,我发现在 Relay State URL 中添加参数 ?url=1 可以打破循环:
authsources.php
'discoURL' => null,
'RelayState' => 'https://example.org/saml_login?url=1',
此外,您可以通过添加 private 指令来更新缓存设置:
lib/SimpleSAML/Utils/HTTP.php
if (!headers_sent()) {
// set the location header
header('Location: ' . $url, true, $code);
// disable caching of this response
header('Pragma: no-cache');
header('Cache-Control: private, no-cache, no-store, must-revalidate');
}