When using models that don't reflect CakePHP's conventions, there are a few things you can configure to get things working.
When you create your User model (or whatever you have called it), you can specify which database the table is in, what the name of the table is, if the table has a prefix, what the primary key field is called (usually id
), and what the display field is (usually name
or title
).
When setting up AuthComponent
, you can also specify what model to use (usually User
) and what the username and password fields are called.
A combination of the above configuration options should usually be enough to get CakePHP understanding how to your table schema is set up.
However, in some cases this isn't enough, so you can override or extends parts of the core AuthComponent
to get it working the way you want (usually just the identify
method is needed, as you pointed out). A few example scenarios would be LDAP authentication, trying to authenticate over multiple User tables, and trying to authenticate where there are joined User and Email tables.