Xsd OneLogin php saml-saml响应问题

Xsd OneLogin php saml-saml响应问题,xsd,single-sign-on,saml-2.0,xsd-validation,onelogin,Xsd,Single Sign On,Saml 2.0,Xsd Validation,Onelogin,我已经使用PHPSAML集成了OneLogin,以连接到我们的idp服务。在我们的登台环境中,一切都与我们使用的设置配合得很好 但是,我在生产环境中使用这些文件时遇到了一个问题 问题是SAML响应没有正确地通过SAML-schema-protocol-2.0.xsdschema进行验证,并且抛出了错误 $settingsInfo = array( 'strict' => true, 'debug' => false, 'sp' => array(

我已经使用PHPSAML集成了OneLogin,以连接到我们的idp服务。在我们的登台环境中,一切都与我们使用的设置配合得很好

但是,我在生产环境中使用这些文件时遇到了一个问题

问题是SAML响应没有正确地通过
SAML-schema-protocol-2.0.xsd
schema进行验证,并且抛出了错误

$settingsInfo = array(
    'strict' => true,
    'debug' => false,
    'sp' => array(
        'entityId' => 'website',
        'assertionConsumerService' => array(
            'url' => "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
            'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
        ) ,
        'NameIDFormat' => 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified',
        'x509cert' => file_get_contents('tool-sso.pem', FILE_USE_INCLUDE_PATH) ,
        'privateKey' => file_get_contents('tool-sso.key', FILE_USE_INCLUDE_PATH) ,
    ) ,
    'idp' => array(
        'entityId' => 'https://sso.example.com',
        'singleSignOnService' => array(
            'url' => 'https://sso.example.com/idp/SSO.saml2',
            'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
        ) ,
        'singleLogoutService' => array(
            'url' => 'https://sso.example.com/idp/SSO.saml2',
            'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
        ) ,
        'x509cert' => file_get_contents('sso.pem', FILE_USE_INCLUDE_PATH)
    ) ,
    'compress' => array(
        'requests' => true,
        'responses' => true
    ) ,
    'security' => array(
        'authnRequestsSigned' => true,
        'signatureAlgorithm' => 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',
    )
);
但是,如果我在安全设置中添加以下行,它就可以正常工作:

'wantxmlvalization'=>false

这使我认为我们从idp返回的SAML响应不知何故不是
xsd
所定义的预期格式

关于什么可能导致
wantxmlvalization=true
失败,您有什么想法吗?这是由于SAML响应中缺少/额外/不正确的数据造成的,还是因为我们如何发送数据

我试图排除idp是这里的问题,但为了保持我们的登台和生产环境同步,我希望将
wantxmlvalization
标志设置为true

我已经尝试使用XSD模式对
验证XML运行响应,结果返回为有效XML

启用XML验证时,我遇到的具体错误如下:

    Warning: DOMDocument::schemaValidate(): Invalid Schema in \\fileshare\root\resources\Classes\OneLogin\src\Saml2\Utils.php on line 135 failed to load external entity "/fileshare/root/resources/Classes/OneLogin/src/Saml2/schemas/xmldsig-core-schema.xsd" Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location '/fileshare/root/resources/Classes/OneLogin/src/Saml2/schemas/xmldsig-core-schema.xsd'. Skipping the import. failed to load external entity "/fileshare/root/resources/Classes/OneLogin/src/Saml2/schemas/xenc-schema.xsd" Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location '/fileshare/root/resources/Classes/OneLogin/src/Saml2/schemas/xenc-schema.xsd'. Skipping the import. Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://www.w3.org/2001/04/xmlenc#}EncryptedData' does not resolve to a(n) element declaration. Element '{http://www.w3.org/2001/XMLSchema}element', attribute 'ref': The QName value '{http://www.w3.org/2001/04/xmlenc#}EncryptedKey' does not resolve to a(n) element declaration. Invalid SAML Response. Not match the saml-schema-protocol-2.0.xsd
invalid_response

OneLogin\Saml2\Auth Object
(
    [_settings:OneLogin\Saml2\Auth:private] => OneLogin\Saml2\Settings Object
环境:

我的安装程序是一个负载平衡器,有两台windows服务器和一个文件共享。用户连接到LB,运行PHP的web服务器从文件共享调用onelogin PHP文件(与web服务器不在同一服务器上)。我提出这个问题的唯一原因是,我想知道是否与
schemaLocations
如何读取
.xsd
文件有关

更新:

我可能已经弄明白了,只是不是更好的解决方法

OneLogin文件
Utils.php
中有一个名为
validateXML
的函数,用于加载模式文件,并将SAML响应与之进行比较。在尝试一个错误后,我将模式文件直接移动到web服务器,而不是文件共享。在移动它们并对这些模式文件的位置进行硬编码之后,问题就解决了

public static function validateXML($xml, $schema, $debug = false)
    {
        assert(is_string($xml) || $xml instanceof DOMDocument);
        assert(is_string($schema));

        libxml_clear_errors();
        libxml_use_internal_errors(true);

        if ($xml instanceof DOMDocument) {
            $dom = $xml;
        } else {
            $dom = new DOMDocument;
            $dom = self::loadXML($dom, $xml);
            if (!$dom) {
                return 'unloaded_xml';
            }
        }

        //$schemaFile = __DIR__ . '/schemas/' . $schema;
        $schemaFile = 'file://C:\inetpub\wwwroot\config\schemas\\'. $schema;
在进行此更改之前,模式文件将一直查看此xsd的文件共享

我不确定这是否是一个路径问题,因为libXML无法读取这样的目录,或者它的权限等

我希望模式与
OneLogin
位于同一文件夹中,而不必从web服务器本身引用它们

在我的道路上有什么我可能会错过的吗