Shibboleth 确实在 PHP 中将属性传递给服务器变量

Shibboleth 确实在 PHP 中将属性传递给服务器变量

我正在构建基于 SAML 的联合身份验证机制,其中 IdP 是 ADFS 2.0,SP 是在 Linux 上运行的 Shibboleth。我可以执行以下操作:

  1. 尝试访问受保护的页面,该页面将我重定向到 IdP 登录页面。
  2. 通过 IdP 登录页面登录并返回受保护的页面。
  3. 浏览到 spserver.internal/Shibboleth.sso/Session 并查看返回的属性,包括 eppn。

但是,我无法以 PHP 中的 REMOTE_USER 标头形式提取 eppn 属性。

我已禁用 attribute-policy.xml(在 shibboleth2.xml 中将其注释掉)。

我遗漏了一些琐碎的事情,我怀疑就我而言,我不知道是什么。要么是 PHP 没有获取 Shibboleth 设置的服务器变量,要么是 Shibboleth 从未设置过这些变量。有什么想法吗?

spserver.internal/Shibboleth.sso/Session 的输出

Miscellaneous
Session Expiration (barring inactivity): 479 minute(s)
Client Address: a.b.c.d
SSO Protocol: urn:oasis:names:tc:SAML:2.0:protocol
Identity Provider: http://veragence.thesixthflag.com/adfs/services/trust
Authentication Time: 2014-10-28T11:55:23.947Z
Authentication Context Class: urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
Authentication Context Decl: (none)

Attributes
eppn: [email protected]

shibboleth2.xml 中的相关行:

    <ApplicationDefaults entityID="https://spURL/shibboleth"
                     REMOTE_USER="eppn persistent-id targeted-id">

attribute-map.xml 中的相关行

<Attribute name="urn:oid:1.3.6.1.4.1.5923.1.1.1.6" id="eppn">
    <AttributeDecoder xsi:type="ScopedAttributeDecoder"/>
</Attribute>

shibd.log 的相关输出

2014-10-28 11:55:21 DEBUG Shibboleth.SSO.SAML2 [2]: extracting issuer from SAML 2.0 assertion
2014-10-28 11:55:21 DEBUG OpenSAML.SecurityPolicyRule.MessageFlow [2]: evaluating message flow policy (replay checking on, expiration 60)
2014-10-28 11:55:21 DEBUG XMLTooling.StorageService [2]: inserted record (_06157709-48ab-4701-90b2-b3ecea5df51f) in context (MessageFlow) with expiration (1414497564)
2014-10-28 11:55:21 DEBUG OpenSAML.SecurityPolicyRule.XMLSigning [2]: validating signature profile
2014-10-28 11:55:21 DEBUG XMLTooling.TrustEngine.ExplicitKey [2]: attempting to validate signature with the peer's credentials
2014-10-28 11:55:21 DEBUG XMLTooling.TrustEngine.ExplicitKey [2]: signature validated with credential
2014-10-28 11:55:21 DEBUG OpenSAML.SecurityPolicyRule.XMLSigning [2]: signature verified against message issuer
2014-10-28 11:55:21 DEBUG OpenSAML.SecurityPolicyRule.BearerConfirmation [2]: assertion satisfied bearer confirmation requirements
2014-10-28 11:55:21 DEBUG Shibboleth.SSO.SAML2 [2]: SSO profile processing completed successfully
2014-10-28 11:55:21 DEBUG Shibboleth.SSO.SAML2 [2]: extracting pushed attributes...
2014-10-28 11:55:21 DEBUG Shibboleth.AttributeExtractor.XML [2]: unable to extract attributes, unknown XML object type: samlp:Response
2014-10-28 11:55:21 DEBUG Shibboleth.AttributeExtractor.XML [2]: unable to extract attributes, unknown XML object type: {urn:oasis:names:tc:SAML:2.0:assertion}AuthnStatement
2014-10-28 11:55:21 INFO Shibboleth.AttributeExtractor.XML [2]: skipping unmapped SAML 2.0 Attribute with Name: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn, Format:urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified
2014-10-28 11:55:21 DEBUG Shibboleth.AttributeDecoder.Scoped [2]: decoding ScopedAttribute (eppn) from SAML 2 Attribute (urn:oid:1.3.6.1.4.1.5923.1.1.1.6) with 1 value(s)
2014-10-28 11:55:21 DEBUG Shibboleth.SSO.SAML2 [2]: resolving attributes...
2014-10-28 11:55:21 DEBUG Shibboleth.AttributeResolver.Query [2]: found AttributeStatement in input to new session, skipping query
2014-10-28 11:55:21 DEBUG Shibboleth.SessionCache [2]: creating new session
2014-10-28 11:55:21 DEBUG Shibboleth.SessionCache [2]: storing new session..

答案1

我认为@pete k 提供的答案是正确的 - 尽管我一开始并不理解。对于其他 Apache 知识有限的人(比如我)尝试配置 Shibboleth,Shibboleth 不会自动将其服务器变量提供给应用程序中的每个页面,除非您明确告诉它这样做。您可以通过将以下类型的代码放入文件中.htaccess或放入文件中来 实现这一点/etc/httpd/conf.d/

<Location /location-you-want-to-access-server-variables>
   AuthType shibboleth
    # ShibRequestSetting requireSession 1
   Require shibboleth
</Location>

如果您取消注释中间的指令,则指定位置的页面将被强制通过 shibboleth 进行身份验证。如果您将其保留为注释,则不会强制授权,但您将可以访问 shibboleth 服务器变量。例如,在 PHP 中,它们可以在$_SERVER- 虽然当然它们不会设置,直到您通过 Shibboleth 进行身份验证。

相关内容