使用SP时Simplesamlphp未处理的异常错误

时间:2013-10-23 16:46:30

标签: single-sign-on saml simplesamlphp

使用simplesamlphp作为服务提供者成功接收SAML 2.0令牌后,我收到以下错误。

 Oct 21 17:30:15 simplesamlphp DEBUG [6b6e3c270f] GenerateGroups - attribute 'eduPersonAffiliation' not found.
    Oct 21 17:30:15 simplesamlphp DEBUG [6b6e3c270f] Session: doLogin("default-sp")
    Oct 21 17:30:15 simplesamlphp WARNING [6b6e3c270f] Unable to find the SAML 2 binding used for this request.
    Oct 21 17:30:15 simplesamlphp WARNING [6b6e3c270f] Request method: 'GET'
    Oct 21 17:30:15 simplesamlphp ERROR [6b6e3c270f] SimpleSAML_Error_Error: UNHANDLEDEXCEPTION
    Oct 21 17:30:15 simplesamlphp ERROR [6b6e3c270f] Backtrace:
    Oct 21 17:30:15 simplesamlphp ERROR [6b6e3c270f] 0 /var/www/simplesamlphp/www/module.php:180 (N/A)
    Oct 21 17:30:15 simplesamlphp ERROR [6b6e3c270f] Caused by: Exception: Unable to find the current binding.
    Oct 21 17:30:15 simplesamlphp ERROR [6b6e3c270f] Backtrace:
    Oct 21 17:30:15 simplesamlphp ERROR [6b6e3c270f] 2 /var/www/simplesamlphp/lib/SAML2/Binding.php:95 (SAML2_Binding::getCurrentBinding)
    Oct 21 17:30:15 simplesamlphp ERROR [6b6e3c270f] 1 /var/www/simplesamlphp/modules/saml/www/sp/saml2-acs.php:11 (require)
    Oct 21 17:30:15 simplesamlphp ERROR [6b6e3c270f] 0 /var/www/simplesamlphp/www/module.php:135 (N/A)
    Oct 21 17:30:15 simplesamlphp ERROR [6b6e3c270f] Error report with id bd213fb5 generated.

我的SP设置如下:

**authsources.php**

    'default-sp' => array(
        'saml:SP',
        'entityID' => NULL,
        'idp' => NULL,
        'discoURL' => NULL,
        'RelayState' => '{link to my application}',
        'acs.Bindings' => array(
            'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
            'urn:oasis:names:tc:SAML:1.0:profiles:browser-post',
        ),
    ),

saml20-IDP-remote.php

$metadata['https://{idp entity id}'] = array(
    'metadata-set' => 'saml20-idp-remote',
    'entityid' => 'https://{idp entity id}',
    'name' => array(
        'en' => 'IDP Name',
        'no' => 'IDP name',
    ),
    'description'  => 'IDP desc',
    'SingleSignOnService' => 
      array (
        0 => 
        array (
          'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
          'Location' => '{SSO url}',
        ),
        1 =>
        array(
          'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact',
          'Location' => '{SSO url}',
        ),
      ),
    'SingleLogoutService'  => '{SLO url}',
    'certFingerprint' => '{the fingerprint}',
);

我是Single Sign on的新手。我也隐藏了保密网址,但我不确定我是否遗漏了某些内容或导致此错误被抛出的内容。如果有人能帮助我指出正确的方向,我将不胜感激。我还要提一下,我正在尝试使用https://drupal.org/project/simplesamlphp_auth来挂钩我的应用程序。

这是IDP第一流程。我使用mysql来存储会话。

2 个答案:

答案 0 :(得分:3)

Unable to find the current binding.”意味着无法确定当前绑定。你的saml20-idp-remote.php提到HTTP-POST绑定,你的日志提到了Request method: 'GET',所以在发布到https://…/module.php/saml/sp/saml2-acs.php/default-sp时可能会出错。

我只是在这里做一个疯狂的猜测,但根据我的经验,最常见的原因是重定向Web服务器。也许你重定向到一个不同的主机名?你强制使用HTTPS吗?检查IdP上 AssertionConsumerService 的URL是否正确 - 他们应该直接引导到SimpleSamlPhp,而不使用任何重定向。

答案 1 :(得分:0)

我遇到了同样的情况。

saml实体指向www.mysite.com 在apache配置中,我们使用重定向代码301将www.mysite.com重定向到mysite.com,在更改为重定向代码307以保留get和post变量后,它开始正常工作。

谢谢, Anubhav