我用Drupal设置了我的SimpleSamlPhp(我在另一台服务器上有我的IdP)。以管理员身份登录“http://localhost:31478/simplesaml/”后,我使用我的IdP运行“测试身份验证源”,显示了具有正确属性的“SAML 2.0 SP演示示例”屏幕。我想这意味着SimpleSamlPhp和我的Idp可以互相看到并正确沟通。
但是,当我在启用“通过SimpleSAMLphp激活身份验证”后尝试使用Drupal进行联合登录时,我收到以下错误:
SimpleSAML_Error_Exception: Could not find the metadata of an IdP with entity ID 'tenant2.test.com' in sspmod_saml_Auth_Source_SP->getIdPMetadata() (line 134 of /var/www/vendor/simplesamlphp/simplesamlphp/modules/saml/lib/Auth/Source/SP.php).
设置
我在/ var中有simplesamlphp目录。对启用saml进行了以下更改
/var/simplesamlphp/config/config.php
'baseurlpath' => 'simplesaml/',
....
'enable.saml20-sp' => true,
'enable.saml20-idp' => true,
'enable.shib13-idp' => false,
'enable.adfs-idp' => false,
'enable.wsfed-sp' => false,
'enable.authmemcookie' => false,
....
'saml' => TRUE,
....
....
'default-saml20-idp' => 'tenant2.test.com',
....
'store.type' => 'memcache',
....
....
'memcache_store.servers' => array(
array(
array('hostname' => 'localhost'),
),
),
'memcache_store.prefix' => 'SimpleSAMLphp',
....
....
'trusted.url.domains' => array('localhost:31478'),
/var/simplesamlphp/config/authsources.php
<?php
$config = array(
'admin' => array(
'core:AdminPassword',
),
'default-sp' => array(
'saml:SP',
'privatekey' => 'saml.pem',
'certificate' => 'saml.crt',
'entityID' => null,
'idp' => 'tenant2.test.com',
'discoURL' => null,
),
);
/var/simplesamlphp/metadata/saml20-idp-remote.php
<?php
$metadata['tenant2.test.com'] = array(
'SingleSignOnService' => 'https://tenant2.test.com/testSamlLogin',
'AssertionConsumerService' => 'http://localhost:31478/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp',
'SingleLogoutService' => 'https://tenant2.test.com/admin/logout',
'certFingerprint' => '0a89aec59bf48e414ec050f6956891cb3f5b09a0',
);
我一直试图解决这个问题几天。我错过了什么吗?
谢谢。
答案 0 :(得分:1)
如果元数据包含“ expire”键并且元数据已过期,也会发现这种情况。尝试在saml20-idp-remote.php
元数据中将其注释掉,看看是否遇到其他错误,因为跳过了错误处理。
答案 1 :(得分:0)
您是否尝试将tenant2.test.com
替换为'entityID'的空值?
答案 2 :(得分:0)
此消息表示身份提供商(IdP)的实体ID不正确和/或未在元数据中找到。
authsources中列出的“entityID”指的是服务提供商(SP)。在你的例子中是'default-sp'。更改此“entityID”不会解决您的问题,因为会更改服务提供商的实体ID。
身份提供商(IdP)的实体ID在“idp”字段中指定。你的'idp设置为'tenant2.test.com'。该值可能缺少一些信息。身份提供商的实体ID通常要长得多。以下是您可能在SimpleSAMLphp身份提供程序(IdP)的联合首页上看到的示例。
SAML 2.0 IdP Metadata
Entity ID: https://samlidp.example.com/simplesaml/saml2/idp/metadata.php
我会查看身份提供程序的元数据,并更新authsources文件的“idp”字段以获得完整的实体ID。
身份提供者(IdP)的实体ID通常也包含在metadata / saml20-idp-remote.php中。我在你的例子中没有看到它。所以我会在这个例子中更新authsources和元数据。
答案 3 :(得分:0)
此问题已解决,请在settings.php中添加simplesamlphp_dir
$settings['simplesamlphp_dir'] = '/var/www/mysite/docroot/simplesaml';