信息哈希中的全身份验证-SAML 零值



我正在使用 devise 和 omniauth-saml,按照 https://github.com/PracticallyGreen/omniauth-saml 和 omniauth Facebook 示例的说明 https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview

我有一个 simplesamlphp 服务器正在运行,使用 omniauth 提供的元数据,一切似乎都连接正常,但来自 simplesaml 服务器的响应对电子邮件、first_name、last_name和名称的值为零。奇怪的是,它返回的电子邮件和名称值,只是不在响应的有用部分(见下文 - super@man.com 是电子邮件,克拉克肯特是名称)

奇怪的是,我同时使用全能身份验证 SAML 和 devise-saml 可验证的宝石获得这些 nil 值,但我认为我的 simplesamlphp 服务器配置正确。

来自全身份验证的响应如下所示:

#<OmniAuth::AuthHash credentials=#<OmniAuth::AuthHash> extra=#<OmniAuth::AuthHash raw_info=#<OneLogin::RubySaml::Attributes:0x007fc695850148 @attributes={"urn:oid:0.9.2342.19200300.100.1.1"=>["super@man.com"], "urn:oid:2.16.840.1.113730.3.1.241"=>["Clark Kent"], "fingerprint"=>"FINGERPRINT REMOVED"}>> info=#<OmniAuth::AuthHash::InfoHash email=nil first_name=nil last_name=nil name=nil> provider="saml" uid="_ca76f49ccb6ccce7827111ae1ff0563f534f0a4d1a">

simplesamlphp 配置如下所示:

$metadata['http://localhost:3000/saml/users/auth/saml/metadata'] = array( 'AssertionConsumerService' => 'http://localhost:3000/saml/users/auth/saml/callback', 'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:email', 'simplesaml.nameidattribute' => 'email', );

我确信数据库中的用户有很好的价值,当我在 IDP 本身上测试身份验证时,一切都按预期工作。

我解决了这个问题。问题是我尝试使用不使用 ldap 属性名称的值。

我更改了我的 sp 元数据,如下所示(修改我的模型以使用 first_name 和 last_name 而不仅仅是名称)

$metadata['http://localhost:3000/saml/users/auth/saml/metadata'] = array(
'AssertionConsumerService' => 'http://localhost:3000/saml/users/auth/saml/callback',
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:email',
'authproc' => array(
95 => array(
    'class' => 'core:AttributeMap',
    'givenName' => 'first_name',
    'sn' => 'last_name',
    'mail' => 'email',
),
96 => array(
    'class' => 'core:AttributeLimit',
    'email', 'first_name', 'last_name'
),
),
'simplesaml.nameidattribute' => 'email',
);

最新更新