2

我要疯了!我有一个用 CakePHP 制作的网站,它将构成移动应用程序的后端。它不是一个移动网站,它纯粹是为智能手机应用而设计的。

话虽这么说:应用程序需要用户登录。但我似乎找不到正确的方法来实现这一点。BasicAuthenticate AuthComponent 似乎讨厌我,并且不会使调试变得容易。CakePHP 2.0有一个OAuth 2.0 Provider 插件,但我不知道如何使它成为两条腿,因为该应用程序不会依赖网站来显示登录表单。

我真的需要弄清楚这些路径中的哪一条以及如何使其发挥作用,但只是没有人愿意工作。有人知道我需要做什么吗?

更新Basic Auth 问题原来是由于 Virtualmin 更喜欢使用 FCGId 以允许进程以与网站内容相同的所有者身份运行。我已经将它切换回 mod_php 并且它工作正常。

所以我的问题现在更多是关于在 2 腿设置中使用cakephp-oauth-server 。

4

1 回答 1

2
public function beforeFilter() {
    parent::beforeFilter();
    $this->Auth->allow('index','view');
    $this->set('logged_in', $this->Auth->loggedIn());
    $this->set('current_user',$this->Auth->user());
    if($this->name == 'Specific') {
            // for the specific controller
            $this->Auth->authenticate = array('Basic');
    } else {
            // everything else
    }
}

结帐 KVZ 的其余插件可能会感兴趣https://github.com/kvz/cakephp-rest-plugin

于 2012-03-04T08:15:15.143 回答