Is it possible to add another input value to authenticate?
For example, currently required values for authentication is ID and password only and I want to add one more input value to authenticate so that ID can be repeated for user management.
・Second question
Is it possible to handle multiple sessions using simpleAuth like following?
You will need create your own Auth class, by extending the Auth_Login_Simpleauth class, and replace the perform_check(), login(), logout() and validate_user() methods.
2. Not out of the box.
Auth supports multiple driver instances, so technically it is possible, but the included Auth options (Simple and ORM) don't support it. So you need to do the same as above, and make sure that you include the instance id. The instance 'id' is an optional field in the auth config, if not given it defaults to the value of 'driver'. In the Login class you can access it using $this->get_id();
Once you have the id, you have to use it to make the session variables unique. So for example where it now uses
\Session::set('username', ...) or \Session::get('username');
it should use something like
\Session::set($this->get_id().'-username', ...) or \Session::get($this->get_id().'-username');
There are two options, either write your own driver (using the Auth_Login_Simpleauth class as a template), or extend Auth_Login_Simpleauth, and overload the methods you need to overload.
Which one is best depends on how much you need to replace.
To give an example, we have an app that uses "Customauth". It is in app/classes/auth/login/customauth.php, and defines:
class Auth_Login_Customauth extends \Auth\Auth_Login_Simpleauth {}
The app/config/auth.php configuration file then contains
'driver' => 'Customauth',
which tells Auth to load it.
So when you use Auth::forge(), you get a Customauth instance back.
To create multiple instances, you can do:
$auth1 = Auth::forge(array('id' => 'auth1');
$auth2 = Auth::forge(array('id' => 'auth2');
(obviously passing additional config data in the array if and when needed)
In your driver, $this->get_id() would then return either 'auth1' or 'auth2', depending on the instance you used. You can then use that to make sure session values like username and stored per driver.