使用CakePHP的SimpleSAML - SimpleSAML_Error_NoState:NOSTATE

时间:2014-11-17 12:59:19

标签: php cakephp saml simplesamlphp

我试图使用CakePHP配置SimpleSAMLPHP,在项目中只使用PHP它工作正常但是使用CakePHP-simpleSAMLphp-Plugin我在尝试访问视图时收到了错误:

    Warning (4096): Argument 1 passed to SamlAuthenticate::unauthenticated() must be an instance of Controller, instance of CakeRequest given, called in C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\lib\Cake\Controller\Component\AuthComponent.php on line 348 and defined [APP\Plugin\Saml\Controller\Component\Auth\SamlAuthenticate.php, line 49]
    Warning (4096): Argument 1 passed to SamlComponent::login() must be an instance of mixed, none given, called in C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\app\Controller\UsersController.php on line 23 and defined [APP\Plugin\Saml\Controller\Component\SamlComponent.php, line 86]
    Notice (8): Undefined variable: url [APP\Plugin\Saml\Controller\Component\SamlComponent.php, line 87]
    Warning (4096): Argument 1 passed to SimpleSAML_Auth_Simple::login() must be of the type array, null given, called in C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\app\Plugin\Saml\Controller\Component\SamlComponent.php on line 87 and defined [C:\xampp\simplesaml\lib\SimpleSAML\Auth\Simple.php, line 100]
    Warning (2): array_key_exists() expects parameter 2 to be array, null given [C:\xampp\simplesaml\lib\SimpleSAML\Auth\Simple.php, line 102]
    Warning (2): array_key_exists() expects parameter 2 to be array, null given [C:\xampp\simplesaml\lib\SimpleSAML\Auth\Simple.php, line 108]
    Warning (2): array_key_exists() expects parameter 2 to be array, null given [C:\xampp\simplesaml\lib\SimpleSAML\Auth\Simple.php, line 110]
    Warning (2): array_key_exists() expects parameter 2 to be array, null given [C:\xampp\simplesaml\lib\SimpleSAML\Auth\Simple.php, line 120]
    Warning (2): Cannot modify header information - headers already sent by (output started at C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\lib\Cake\Utility\Debugger.php:801) [C:\xampp\simplesaml\lib\SimpleSAML\Utilities.php, line 585]
    Warning (2): Cannot modify header information - headers already sent by (output started at C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\lib\Cake\Utility\Debugger.php:801) [C:\xampp\simplesaml\lib\SimpleSAML\Utilities.php, line 588]
    Warning (2): Cannot modify header information - headers already sent by (output started at C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\lib\Cake\Utility\Debugger.php:801) [C:\xampp\simplesaml\lib\SimpleSAML\Utilities.php, line 589]

Redirect   
You were redirected to: https://mysaml:9443/samlsso?...

登录后我收到了回复:

SimpleSAML_Error_NoState: NOSTATE
Backtrace:
2 C:\xampp\simplesaml\lib\SimpleSAML\Auth\State.php:225 (SimpleSAML_Auth_State::loadState)
1 C:\xampp\simplesaml\modules\saml\www\sp\saml2-acs.php:63 (require)
0 C:\xampp\simplesaml\www\module.php:134 (N/A)

我使用CakePHP(2.5.2)和SimpleSAMLPHP(1.13.2)

修改

这是unauthenticated()方法:

public function unauthenticated(Controller $controller) {
        return $this->Saml->isAuthenticated();
    }

这是var_dump的{​​{1}}:

$controller

我尝试改变:

object(CakeRequest)#9 (9) {
  ["params"]=>
  array(5) {
    ["plugin"]=>
    NULL
    ["controller"]=>
    string(5) "users"
    ["action"]=>
    string(5) "login"
    ["named"]=>
    array(0) {
    }
    ["pass"]=>
    array(0) {
    }
  }
  ["data"]=>
  array(0) {
  }
  ["query"]=>
  array(0) {
  }
  ["url"]=>
  string(11) "users/login"
  ["base"]=>
  string(22) "/Projeto"
  ["webroot"]=>
  string(23) "/Projeto/"
  ["here"]=>
  string(34) "/Projeto/users/login"
  ["_detectors":protected]=>
  array(11) {
    ["get"]=>
    array(2) {
      ["env"]=>
      string(14) "REQUEST_METHOD"
      ["value"]=>
      string(3) "GET"
    }
    ["post"]=>
    array(2) {
      ["env"]=>
      string(14) "REQUEST_METHOD"
      ["value"]=>
      string(4) "POST"
    }
    ["put"]=>
    array(2) {
      ["env"]=>
      string(14) "REQUEST_METHOD"
      ["value"]=>
      string(3) "PUT"
    }
    ["delete"]=>
    array(2) {
      ["env"]=>
      string(14) "REQUEST_METHOD"
      ["value"]=>
      string(6) "DELETE"
    }
    ["head"]=>
    array(2) {
      ["env"]=>
      string(14) "REQUEST_METHOD"
      ["value"]=>
      string(4) "HEAD"
    }
    ["options"]=>
    array(2) {
      ["env"]=>
      string(14) "REQUEST_METHOD"
      ["value"]=>
      string(7) "OPTIONS"
    }
    ["ssl"]=>
    array(2) {
      ["env"]=>
      string(5) "HTTPS"
      ["value"]=>
      int(1)
    }
    ["ajax"]=>
    array(2) {
      ["env"]=>
      string(21) "HTTP_X_REQUESTED_WITH"
      ["value"]=>
      string(14) "XMLHttpRequest"
    }
    ["flash"]=>
    array(2) {
      ["env"]=>
      string(15) "HTTP_USER_AGENT"
      ["pattern"]=>
      string(26) "/^(Shockwave|Adobe) Flash/"
    }
    ["mobile"]=>
    array(2) {
      ["env"]=>
      string(15) "HTTP_USER_AGENT"
      ["options"]=>
      array(26) {
        [0]=>
        string(7) "Android"
        [1]=>
        string(7) "AvantGo"
        [2]=>
        string(10) "BlackBerry"
        [3]=>
        string(6) "DoCoMo"
        [4]=>
        string(6) "Fennec"
        [5]=>
        string(4) "iPod"
        [6]=>
        string(6) "iPhone"
        [7]=>
        string(4) "iPad"
        [8]=>
        string(4) "J2ME"
        [9]=>
        string(4) "MIDP"
        [10]=>
        string(8) "NetFront"
        [11]=>
        string(5) "Nokia"
        [12]=>
        string(10) "Opera Mini"
        [13]=>
        string(10) "Opera Mobi"
        [14]=>
        string(6) "PalmOS"
        [15]=>
        string(10) "PalmSource"
        [16]=>
        string(9) "portalmmm"
        [17]=>
        string(7) "Plucker"
        [18]=>
        string(14) "ReqwirelessWeb"
        [19]=>
        string(12) "SonyEricsson"
        [20]=>
        string(7) "Symbian"
        [21]=>
        string(11) "UP\.Browser"
        [22]=>
        string(5) "webOS"
        [23]=>
        string(10) "Windows CE"
        [24]=>
        string(16) "Windows Phone OS"
        [25]=>
        string(5) "Xiino"
      }
    }
    ["requested"]=>
    array(2) {
      ["param"]=>
      string(9) "requested"
      ["value"]=>
      int(1)
    }
  }
  ["_input":protected]=>
  string(0) ""
}

警告没有发生但仍无效。

1 个答案:

答案 0 :(得分:0)

决议的链接: https://github.com/zl4bv/CakePHP-simpleSAMLphp-Plugin/issues/7#issuecomment-63427478

我需要在config/config.php中将会话类型更改为'sql':

'store.type' => 'sql',

一切正常!