PHP Класс 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.
Автор: sl
Автор: Kevin Papst
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$database Kimai_Database_Mysql
$kga Kimai_Config

Открытые методы

Метод Описание
__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 )

Защищенные методы

Метод Описание
getDatabase ( ) : Kimai_Database_Mysql
getKga ( ) : Kimai_Config
setConfig ( $key, $value ) Set one config value.

Описание методов

__construct() публичный Метод

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

authenticate() абстрактный публичный Метод

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
Результат boolean either true if the credentials were correct, or false otherwise

autoLoginPossible() публичный Метод

This allows users to be logged in automatically. Mostly used with SSO (single sign on) solutions.
public autoLoginPossible ( ) : boolean
Результат boolean true if this authentication method can login users without credentials, false otherwise

getDatabase() защищенный Метод

protected getDatabase ( ) : Kimai_Database_Mysql
Результат Kimai_Database_Mysql

getDefaultGlobalRole() публичный Метод

The default implementation uses the first role or, if present, a role called 'User'.
public getDefaultGlobalRole ( ) : integer
Результат integer global role ID

getDefaultGroups() публичный Метод

The default implementation uses the second group and and a membership role named 'User', otherwise the first one it can find.
public getDefaultGroups ( ) : array
Результат array id of the group to add the user to

getKga() защищенный Метод

protected getKga ( ) : Kimai_Config
Результат Kimai_Config

performAutoLogin() публичный Метод

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
Результат boolean either true if the user could be authenticated or false otherwise

setConfig() защищенный Метод

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

setDatabase() публичный Метод

public setDatabase ( Kimai_Database_Mysql $database )
$database Kimai_Database_Mysql

setKga() публичный Метод

public setKga ( Kimai_Config $kga )
$kga Kimai_Config

Описание свойств

$database защищенное свойство

protected Kimai_Database_Mysql $database
Результат Kimai_Database_Mysql

$kga защищенное свойство

protected Kimai_Config $kga
Результат Kimai_Config