我尝试在本地安装SP和IDP,所以我创建了另一个主机:
127.0.0.1 localhost
::1 localhost
127.0.0.1 auth.saml.net
我创建了2个虚拟主机(一个用于SP,另一个用于Idp)
<VirtualHost auth.saml.net:80>
ServerAdmin toto@gmail.com
ServerName auth.saml.net
AddDefaultCharset UTF-8
Alias /simplesaml c:/wamp/www/var2/simplesamlphp/www/
<Directory c:/wamp/www/var2/simplesamlphp/www/ >
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
<VirtualHost localhost:80>
ServerAdmin toto@gmail.com
ServerName localhost
AddDefaultCharset UTF-8
Alias /simplesaml c:/wamp/www/var/simplesamlphp/www/
</VirtualHost>
(文件夹var2用于我的IDP,文件夹var用于我的SP,它不是很干净,但实际上我只是想让它工作)
在第二部分我通过编辑每个文件夹中的文件config / config.php来配置我的SP和我的idp(我不要忘记为IDP将enable.saml20-idp设置为true)
接下来,我从我的idp编辑文件config / authsources.php,我有2个假用户:
'example-userpass' => array(
'exampleauth:UserPass',
'user1:pwd' => array(
'uid' => array('user1'),
'mail' => 'user1@test.com',
'first_name' => 'User',
'last_name' => 'One'
),
'user2:pwd' => array(
'uid' => array('user2'),
'mail' => 'user2@test.com',
'first_name' => 'User',
'last_name' => 'Two'
)
)
我还在我的SP部分编辑文件config / authsources.php:
'default-sp' => array(
'saml:SP',
'entityID' => 'auth.saml.net',
'idp' => 'auth.saml.net/simplesaml/saml2/idp/metadata.php',
'ssoPortalUrl'=> 'auth.saml.net/simplesaml/saml2/idp/SSOService.php',
'discoURL' => null
);
接下来,我将IDP(联盟 - &gt;打印元数据 - &gt; SimpleSAMLphp平面文件格式)中的元数据复制到文件“metadata / saml20-idp-remote.php”中的SP:
$metadata['auth.saml.net/simplesaml/saml2/idp/metadata.php'] = array (
'metadata-set' => 'saml20-idp-remote',
'entityid' => 'auth.saml.net/simplesaml/saml2/idp/metadata.php',
'SingleSignOnService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
'Location' => 'auth.saml.net/simplesaml/saml2/idp/SSOService.php',
),
),
'SingleLogoutService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
'Location' => 'auth.saml.net/simplesaml/saml2/idp/SingleLogoutService.php',
),
),
'certData' => 'certData',
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
);
以及我的SP中的元数据到'metadata / saml20-sp-remote.php'文件中的IDP:
$metadata['auth.saml.net'] = array (
'SingleLogoutService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
'Location' => 'http://localhost/simplesaml/module.php/saml/sp/saml2-logout.php/default-sp',
),
),
'AssertionConsumerService' =>
array (
0 =>
array (
'index' => 0,
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
'Location' => 'http://localhost/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp',
),
1 =>
array (
'index' => 1,
'Binding' => 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post',
'Location' => 'http://localhost/simplesaml/module.php/saml/sp/saml1-acs.php/default-sp',
),
2 =>
array (
'index' => 2,
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact',
'Location' => 'http://localhost/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp',
),
3 =>
array (
'index' => 3,
'Binding' => 'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01',
'Location' => 'http://localhost/simplesaml/module.php/saml/sp/saml1-acs.php/default-sp/artifact',
),
),
);
但是当我尝试通过点击“测试配置的身份验证源”进行测试时,我收到以下错误信息:
Exception during login:
SimpleSAML_Error_Exception: Could not find the metadata of an IdP with entity ID 'auth.saml.net/simplesaml/saml2/idp/metadata.php'
Backtrace:
6 C:\wamp\www\var\simplesamlphp\modules\saml\lib\Auth\Source\SP.php:134 (sspmod_saml_Auth_Source_SP::getIdPMetadata)
5 C:\wamp\www\var\simplesamlphp\modules\saml\lib\Auth\Source\SP.php:308 (sspmod_saml_Auth_Source_SP::startSSO)
4 C:\wamp\www\var\simplesamlphp\modules\saml\lib\Auth\Source\SP.php:390 (sspmod_saml_Auth_Source_SP::authenticate)
3 C:\wamp\www\var\simplesamlphp\lib\SimpleSAML\Auth\Default.php:65 (SimpleSAML_Auth_Default::initLogin)
2 C:\wamp\www\var\simplesamlphp\lib\SimpleSAML\Auth\Simple.php:136 (SimpleSAML_Auth_Simple::login)
1 C:\wamp\www\var\simplesamlphp\modules\core\www\authenticate.php:45 (require)
0 C:\wamp\www\var\simplesamlphp\www\module.php:134 (N/A)
我已经尝试从开始重建配置,但错误仍在此处。当我转到'auth.saml.net/simplesaml/saml2/idp/metadata.php'链接时,元数据打印得很好。
答案 0 :(得分:1)
我犯了几个错误:
答案 1 :(得分:0)
'default-sp'=&gt;阵列( 'SAML:SP', 'idp'=&gt; 'auth.saml.net/simplesaml/saml2/idp/metadata.php',
);