simplesamlphp中的重定向太多

simplesamlphp中的重定向太多,php,simplesamlphp,Php,Simplesamlphp,当添加一个新的应用程序来访问saml时,我面临着这个问题 php:1get net::ERR\u太多\u重定向 在我的本地服务器中,我没有遇到任何问题,但是当我将代码复制到临时服务器时,它会显示ERR_TOO_MANY_重定向错误,继续重定向,并且无法显示saml登录页面。带负载平衡器的暂存服务器,这会导致错误吗 谢谢 更新: $config = array( 'baseurlpath' => 'https://saml.testing.net/', 'certdir'

当添加一个新的应用程序来访问saml时,我面临着这个问题

php:1get

net::ERR\u太多\u重定向

在我的本地服务器中,我没有遇到任何问题,但是当我将代码复制到临时服务器时,它会显示ERR_TOO_MANY_重定向错误,继续重定向,并且无法显示saml登录页面。带负载平衡器的暂存服务器,这会导致错误吗

谢谢

更新:

$config = array(
'baseurlpath'       => 'https://saml.testing.net/',
'certdir'       => '/etc/test/sslcerts/',
'tempdir'       => '/tmp',
'datadir'       => 'data/',
'auth.adminpassword'        => '1234567',
'admin.protectindexpage'    => TRUE,
'admin.protectmetadata'     => TRUE,
'secretsalt'        => 'xxxxxxxxx',
'timezone'      => NULL,

// logging related options
'loggingdir'        => '/var/log/simplesamlphp/',
'logging.level'     => LOG_WARNING,
'logging.logfile'   => 'simplesaml_' .date("Ymd") . '.log',
'debug'         => true,
'showerrors'        => true,
'logging.handler'   => 'file',
'logging.facility'  => LOG_USER,
'logging.processname'   => 'simplesaml',
'debug.validatexml' => FALSE,
'enable.saml20-idp' => TRUE,
'enable.shib13-idp' => FALSE,
'enable.adfs-idp'   => FALSE,
'enable.wsfed-sp'   => FALSE,
    'enable.authmemcookie'  => TRUE,
'session.duration'      => 2*(60*60),
'session.requestcache'      => 4*(60*60),
'session.cookie.lifetime'   => 0,
'session.cookie.path'       => '/',
'session.phpsession.cookiename' => 'SimpleSAMLSessionID',
'session.cookie.name'       => 'SimpleSAMLSessionID',
'session.cookie.domain'     => NULL,
'session.cookie.secure'     => FALSE,
'session.cookie.lifetime'   => 0,
'session.datastore.timeout' => 4*(60*60),
'session.state.timeout'     => (60*60),
'session.phpsession.savepath'   => NULL,
'session.phpsession.httponly'   => FALSE,
'session.disable_fallback'  => FALSE,
'session.authtoken.cookiename'  => 'SimpleSAMLAuthToken',
'session.rememberme.enable' => FALSE,
'session.rememberme.checked'    => FALSE,
'session.rememberme.lifetime'   => 1209600, // 14 days
'enable.http_post'      => FALSE,
'language.available'        => array('en'),
'language.default'      => 'en',
'attributes.extradictionary'    => NULL,
'theme.use'         => 'oldtheme:abcdef',
'attributes.extradictionary'    => NULL,
'default-wsfed-idp'     => 'urn:federation:pingfederate:localhost',
'idpdisco.enableremember'   => TRUE,
'idpdisco.rememberchecked'  => TRUE,
'idpdisco.validate'     => TRUE,
'idpdisco.extDiscoveryStorage'  => NULL,
'idpdisco.layout'       => 'dropdown',
'shib13.signresponse'       => TRUE,
'authproc.idp'      => array(
    10 => "frogauth:LogHandler",
    30 => 'core:LanguageAdaptor',
    45 => array('class' => 'core:StatisticsWithAttribute', 'attributename' => 'realm', 'type' => 'saml20-idp-SSO'),
    50 => 'core:AttributeLimit',
    99 => 'core:LanguageAdaptor',
    100 => "newauth:ToLogin",
    101 => "newauth:VerifyLogin",
    99 => 'core:LanguageAdaptor',
),

'authproc.sp'       => array(
    99 => 'core:LanguageAdaptor',
),
'metadata.sources' => array(
    array('type' => 'flatfile'),
),

'store.type'    => 'memcache',
'memcache_store.servers' => array(
            array(
                    array('hostname' => '10.11.11.11'),
            ),
),
'memcache_store.expires' =>  36 * (60*60),
'metadata.sign.enable'      => FALSE,
'metadata.sign.privatekey'  => NULL,
'metadata.sign.privatekey_pass' => NULL,
'metadata.sign.certificate' => NULL,
'proxy'         => null,
'xframe_options'=> array( 'enable' => TRUE, 'trusted_sites' => array()),
'session.duration'      => 2*(60*60),
'theme.use'     => "newtheme:multitheme",
);
saml20-sp-remote.php

$metadata['newapp'] = array(
    'AssertionConsumerService'      => 'https://www.newapp.com/mobile/saml',
    'SingleLogoutService'           => 'https://www.newapp.com/mobile/logout',
    'Theme'         => 'mobile',
);

当页面内容结束时,请关闭连接。

如果有帮助的话,无论何时在我们的设置中出现这种情况,都是因为Cookie出了问题

由于cookie设置不正确,用户未被视为已登录服务。因此,它们被重定向到idp,此时它们显示为已登录,并重定向回服务;然后重复


基本上你的服务认为他们没有登录,saml认为他们是;他们俩都在推卸责任

我刚刚遇到了类似的重定向问题。SimpleSAMLPHP可以很好地加载,但当尝试以管理员身份登录时,它将进入一个无限循环,加载loginuserpass.php和as_login.php页面(最初从/module.php/core/login admin.php?ReturnTo=XXX重定向)

经过大量调试后,我发现问题实际上是Varnish缓存导致会话状态无法加载。无论选择了什么会话存储(phpsession、memcache或sql),都会发生这种情况

在SimpleSAMLPHP路径上禁用varnish缓存修复了这个问题


希望这能帮助其他人解决这个问题。

这里还有另一个可能的解决方案可以尝试(搜索数小时后对我有效,更正
'session.phpsession.savepath'
):进入Firefox开发者工具(或您选择的浏览器)和“web存储”删除所有cookie。

在我的例子中,cookie属性是罪魁祸首SameSite=Nonecookies必须与secure属性一起使用

解决方案:

'session.cookie.secure' => true // config.php
如果您的服务运行在反向代理之后,而不是通过https运行,则还需要定义URL架构:

'baseurlpath' => 'https://my.url.com/<path_to_simple_saml>' // indicating the https schema (config.php)
'baseurlpath'=>'https://my.url.com/'//指示https架构(config.php)

如果不检查代码,任何人都无法解决。检查标题函数并使用exit();在每个标题函数之后。这可能是原因。如果您可以在登台服务器上包含您的配置,则会更容易提供帮助。设置的重定向URL等。否则,最好的猜测是其中一个重定向设置不正确,导致无限循环。我得到了相同的错误。在我的例子中,我使用sqlite数据库的无效路径来存储会话信息。i、 e.“store.sql.dsn”配置。您是如何禁用varnish缓存的?只需更改varnish.vcl文件以排除SimpleSAMLPHP路径这在设置为使用https后对我有效。我发现,如果不使用https,大多数SAML IdP和/或中间件都无法工作(或工作得不够好)。如果您使用的是SAML,那么只有使用https才有意义。