Many thanks to Servat and Weldon for giving me easier ways to solve my problem. Yeah, login have username and password always. But my project uses SSO (using Active Directory and LdapUser). Right now, I have no Active Directory to connect to, so my password field is disabled and that is the reason why I have to know more about cakePHP authenticate components.
Additionally, my users, roles tables is based on customer's existing structures. So I have to write my extention of AuthComponent. Have you got any experience about LdapUser & SSO ? --------------------------------- Best regards ! Giang Son Dat On vacation Mobile: +84 988114164 Email [email protected], [email protected] On Thu, Feb 5, 2009 at 7:00 PM, Gonzalo Servat <[email protected]> wrote: > On Thu, Feb 5, 2009 at 11:49 PM, datgs <[email protected]> wrote: > >> >> Hi everybody, >> >> I've had to rewrite code in AuthComponent class to login with username >> only. >> >> Was it the best way for my purpose. Is there any way without changing >> the code in AuthComponent. >> > > I had to do this as I wanted a site that was protected by lots of unique > codes (ie. usernames) but no passwords. The way I did it was by doing the > following in my users_controller.php: > > function beforeFilter() { > parent::beforeFilter(); > $this->Auth->fields['password'] = 'username'; > $this->Auth->authenticate = $this->User; > } > > .. and in my user.php model: > > function hashPasswords( $data ) { > return $data; > } > > The hashPasswords() function basically returns the password as is (in > clear-text) so that I can lookup the code in my users table. I just have a > "username" column and no password column. > > I doubt this is the ideal way to do it, but it works for me. > > - Gonzalo > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
