Saturday, November 3, 2012

Re: Issues with digest authentication - need some help

in app controller

public function isAuthorized() {
  return $this->Auth->user('id');
}

this should solve your problems.



On Fri, Nov 2, 2012 at 5:16 PM, Nir Regev <nregev@gmail.com> wrote:
Hi all !

I'm rather mew to cake and trying to create a set of REST services with the need for DIGEST auth.

configuration :
- I'm using cake 2.2.3 
- in AppController I've got this setup :

public $components = array(
    'RequestHandler',
    'Session',
    'Auth' => array(
        'authenticate' => array(
            'Digest' => array(
                'userModel' => 'User',
                'realm' => 'somerealm',
                'fields' => array ('password' => 'digest_hash')
            )
        ),
        'authorize' => array('Controller')
    )

beforeFilter functions are not defined in Users/App controller

in UsersController I'v added a 'whoami' function to show currently logged on user name

Using curl --digest --user  "user:pass" "http://127.0.0.1/cake/Users/whoami

problem is : I can never get the user to login ! 
hashes and all are fine, same user can login user forms auth. if I allow it.

curl gets 302 redirect to /Users/login

The only time I can get 'whoami' to work is if I Auth->allow it in beforeFilter but then I naturally don't have the user logged in.

Any suggestions ?

Thanks, Nir.



--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 



--
Ivan Rimac
tel: +385 95 555 99 66

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: