PHP Class Kimai_Auth_Abstract

The order of the functions is closely related to the order they are called. First it is checked if automatic login is possible with this method. If so it is tried via the performAutoLogin function. When a user provides credentials the authenticate function is called.
Author: sl
Author: Kevin Papst
Mostrar archivo Open project: kimai/kimai Class Usage Examples

Protected Properties

Property Type Description
$database Kimai_Database_Mysql
$kga Kimai_Config

Public Methods

Method Description
__construct ( Kimai_Database_Mysql $database = null, Kimai_Config $kga = null )
authenticate ( string $username, string $plainPassword, integer &$userId ) : boolean Authenticate a combination of username and password. Both is given as the user wrote it into the input fields.
autoLoginPossible ( ) : boolean Decides whether this authentication method should be used to authenticate users before they have provided any credentials.
getDefaultGlobalRole ( ) : integer Return an ID of a global role to which users should be added, if they authenticated but are not known to Kimai.
getDefaultGroups ( ) : array Return a map from group IDs to membership role IDs to which users should be added, if they authenticated but are not known to Kimai.
performAutoLogin ( integer &$userId ) : boolean Try to authenticate the user before he sees the login page.
setDatabase ( Kimai_Database_Mysql $database )
setKga ( Kimai_Config $kga )

Protected Methods

Method Description
getDatabase ( ) : Kimai_Database_Mysql
getKga ( ) : Kimai_Config
setConfig ( $key, $value ) Set one config value.

Method Details

__construct() public method

public __construct ( Kimai_Database_Mysql $database = null, Kimai_Config $kga = null )
$database Kimai_Database_Mysql
$kga Kimai_Config

authenticate() abstract public method

Authenticate a combination of username and password. Both is given as the user wrote it into the input fields.
abstract public authenticate ( string $username, string $plainPassword, integer &$userId ) : boolean
$username string name of the user who wants to authenticate
$plainPassword string password in plaintext the user has provided
$userId integer user id. If none exists it will be false
return boolean either true if the credentials were correct, or false otherwise

autoLoginPossible() public method

This allows users to be logged in automatically. Mostly used with SSO (single sign on) solutions.
public autoLoginPossible ( ) : boolean
return boolean true if this authentication method can login users without credentials, false otherwise

getDatabase() protected method

protected getDatabase ( ) : Kimai_Database_Mysql
return Kimai_Database_Mysql

getDefaultGlobalRole() public method

The default implementation uses the first role or, if present, a role called 'User'.
public getDefaultGlobalRole ( ) : integer
return integer global role ID

getDefaultGroups() public method

The default implementation uses the second group and and a membership role named 'User', otherwise the first one it can find.
public getDefaultGroups ( ) : array
return array id of the group to add the user to

getKga() protected method

protected getKga ( ) : Kimai_Config
return Kimai_Config

performAutoLogin() public method

Try to authenticate the user before he sees the login page.
public performAutoLogin ( integer &$userId ) : boolean
$userId integer user id. If none exists it will be false
return boolean either true if the user could be authenticated or false otherwise

setConfig() protected method

By default it uses instance properties.
protected setConfig ( $key, $value )
$key
$value

setDatabase() public method

public setDatabase ( Kimai_Database_Mysql $database )
$database Kimai_Database_Mysql

setKga() public method

public setKga ( Kimai_Config $kga )
$kga Kimai_Config

Property Details

$database protected_oe property

protected Kimai_Database_Mysql $database
return Kimai_Database_Mysql

$kga protected_oe property

protected Kimai_Config $kga
return Kimai_Config