我正在使用one-login的php-saml库用作SP来连接到客户端的IDP。但是,出于某种原因,当客户端发送其 SAML 响应时,由
$_SESSION['samlUserdata'] = $auth->getAttributes()
返回空。如果有人对发生这种情况的原因有任何见解,如果您愿意分享,我们将不胜感激。
首先,我建议检查您自己的 saml 元数据。
您是否有想要获取的属性列表?喜欢:
<md:AttributeConsumingService index="1">
<md:ServiceName xml:lang="en">Service</md:ServiceName>
<md:ServiceDescription xml:lang="en">Sign-on</md:ServiceDescription>
<md:RequestedAttribute Name="username" isRequired="true" />
<md:RequestedAttribute Name="email" isRequired="true" />
<md:RequestedAttribute Name="firstName" isRequired="true" />
<md:RequestedAttribute Name="lastName" isRequired="true" />
</md:AttributeConsumingService>
其次,如果适用,请尝试捕获传入的请求并手动分析它。
此外,请确保根据元数据正确配置客户端。
它不会发送有关登录用户的所有内容。
客户端必须显式声明/映射/配置 SAML 的属性。