get_id()
Returns the drivers unique id. This can be used to identify the driver, or to select a specific driver instance.
Static | No |
---|---|
パラメータ | None |
返り値 | The drivers id string. |
例 |
|
The Auth package provides a standardized interface for authentication in Fuel. This allows our users to write their own drivers and easily integrate a new driver to work with old code by keeping the basic methods consistent.
This driver is the base class for all Auth login drivers. It is defined as an abstract class which contains all methods generic to all login drivers, and abstract method definitions for all methods any login driver MUST implement.
A group driver can load additional drivers that it depends on. Generally, these are ACL drivers. But your implementation could introduce and use custom driver types as well. To do so, add this structure to your driver class:
// autoload the SimpleGroup group driver when loading this login driver
// this also defines the additional user record fields this driver has a getter for
protected $config = array(
'drivers' => array('group' => array('SimpleGroup')),
'additional_fields' => array('profile_fields'),
);
Generic methods are defined in the login base driver, and are available to all Auth login drivers through extension. These methods provide functions to create and retrieve instances, to set and get configuration values, as well as generic method for password hashing and access to the ACL and Group drivers.
The methods defined in the classes but not documented here are used internally, and should not be called directly.
Returns the drivers unique id. This can be used to identify the driver, or to select a specific driver instance.
Static | No |
---|---|
パラメータ | None |
返り値 | The drivers id string. |
例 |
|
Sets a driver configuration value.
Static | No | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
|||||||||
返り値 | void | |||||||||
例 |
|
Gets a driver configuration value.
Static | No | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
パラメータ |
|
|||||||||
返り値 | mixed | |||||||||
例 |
|
Returns if the driver supports guest logins (a non-authenticated guest user).
Static | No |
---|---|
パラメータ | None. |
返り値 | boolean |
例 |
|
By default, this method returns 'false'. If your login driver supports guest logins, overload this method in your driver class.
Returns an array describing the current logged in user, always includes at least a screenname and an emailaddress. Additional fields can be configured in the driver config or requested through the $additional_fields array, but they must have a get_user_fieldname() method within the driver to be gettable.
Static | No | ||||||
---|---|---|---|---|---|---|---|
パラメータ |
|
||||||
返り値 | array | ||||||
例 |
|
You can define the 'additional_fields' in the driver configuration array to have them included by default when you call this method.
Returns a base64 encoded hash of the given password. This method uses the very secure pbkdf2 hashing algorithm.
Static | No | ||||||
---|---|---|---|---|---|---|---|
パラメータ |
|
||||||
返り値 | string | ||||||
例 |
|
Every login driver you develop MUST provide all of these methods, and the MUST return the values documented here.
Internal class method which checks if there is a valid session for the current user. It is up to you how your driver will determine this.
Static | No |
---|---|
パラメータ | None |
返り値 | boolean, true if there is a valid user session, false if there isn't. |
This method is called by Auth::check(), it should not be called directly by the application.
The validate_user method validates a login request. It is up to you how your driver will do this.
Static | No |
---|---|
パラメータ | None |
返り値 | mixed. it should return false if the user didn't pass validation. Any value that evaluates to true is considered to be valid. |
Applications calling this method should not make assumptions about the return value if it isn't false!
The login method performs a login request. It should call the validate_user() to validate the request. It is up to you how your driver will do this.
Static | No |
---|---|
パラメータ | None |
返り値 | boolean. returns true if the login was succesful, false otherwise. |
If your driver has guest user support, it should setup the guest before returning false.
The logout method logs out the current logged-in user. It is up to you how your driver will do this.
Static | No |
---|---|
パラメータ | None |
返り値 | boolean. returns true if the logout was succesful, false otherwise. |
If your driver has guest user support, it should setup the guest as current user after a succesful logout.
The get_user_id method returns an array structure containing the drivers id value, and the id of the currently logged-in user.
Static | No |
---|---|
パラメータ | None |
返り値 | mixed. returns an array in the form array(driver_id, user_id) if a user is logged in, or false otherwise. |
If your driver has guest user support, it should return the array with the (dummy) user_id of your guest, and not false!
The get_groups method returns the user groups assigned to the currently logged-in user.
Static | No |
---|---|
パラメータ | None |
返り値 | mixed. returns an array in the form array(array(driver_id, group_id), array(driver_id, group_id), etc) if a user is logged in, or false otherwise. |
If your driver has guest user support, it should return the array your guest user groups, and not false!
The get_email method returns the email address assigned to the currently logged-in user.
Static | No |
---|---|
パラメータ | None |
返り値 | mixed. returns an email address if a user is logged in, or false if no email address is defined for the current user, or there is no user logged-in. |
If your driver has guest user support, don't forget to return false if the guest does not have an email address defined!
The get_screen_name method returns the screen- or display name of the currently logged-in user.
Static | No |
---|---|
パラメータ | None |
返り値 | mixed. returns a string containing the name, or false if there is no user logged-in. |
If your driver has guest user support, it should return the guests display name, and not false!