PHP Класс Horde_Auth_Base, horde

Автор: Chuck Hagenbuch ([email protected])
Автор: Michael Slusarz ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$_capabilities array An array of capabilities, so that the driver can report which operations it supports and which it doesn't.
$_credentials array The credentials currently being authenticated.
$_error array Authentication error information.
$_history_api Horde_History History object.
$_lock_api Horde_Lock Lock object.
$_logger Horde_Log_Logger Logger object.
$_params array Hash containing parameters needed for the drivers.

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

Метод Описание
__construct ( array $params = [] ) Constructor.
addUser ( string $userId, array $credentials ) Adds a set of authentication credentials.
authenticate ( string $userId, array $credentials, boolean $login = true ) : boolean Finds out if a set of login credentials are valid, and if requested, mark the user as logged in in the current session.
exists ( string $userId ) : boolean Checks if $userId exists in the system.
getCredential ( mixed $name = null ) : mixed Returns internal credential value(s).
getError ( boolean $msg = false ) : mixed Returns the error type or message for an invalid authentication.
getParam ( string $param ) : string Returns the named parameter for the current auth driver.
hasCapability ( string $capability ) : boolean Queries the current driver to find out if it supports the given capability.
isLocked ( string $userId, boolean $show_details = false ) : boolean | array Returns whether a user is currently locked.
listUsers ( boolean $sort = false ) : mixed Lists all users in the system.
lockUser ( string $userId, integer $time ) Locks a user indefinitely or for a specified time.
removeUser ( string $userId ) Deletes a set of authentication credentials.
resetPassword ( string $userId ) : string Reset a user's password. Used for example when the user does not remember the existing password.
searchUsers ( string $search ) : array Searches the users for a substring.
setCredential ( string $type, mixed $value ) Sets an internal credential value.
setError ( string $type, string $msg = null ) Sets the error message for an invalid authentication.
transparent ( ) : boolean Automatic authentication.
unlockUser ( string $userId, boolean $resetBadLogins = false ) Unlocks a user and optionally resets the bad login count.
updateUser ( string $oldID, string $newID, array $credentials ) Updates a set of authentication credentials.
validateAuth ( ) : boolean Checks for triggers that may invalidate the current auth.

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

Метод Описание
_authenticate ( string $userId, array $credentials ) Authentication stub.
_badLogin ( string $userId ) Handles a bad login.
_resetBadLogins ( string $userId ) Resets the bad login counter.
_sort ( array $users, boolean $sort ) : array Basic sort implementation.

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

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

Constructor.
public __construct ( array $params = [] )
$params array Optional parameters: - default_user: (string) The default user. - logger: (Horde_Log_Logger, optional) A logger object. - lock_api: (Horde_Lock, optional) A locking object. - history_api: (Horde_History, optional) A history object. - login_block_count: (integer, optional) How many failed logins trigger autoblocking? 0 disables the feature. - login_block_time: (integer, options) How many minutes should autoblocking last? 0 means no expiration.

_authenticate() абстрактный защищенный Метод

On failure, Horde_Auth_Exception should pass a message string (if any) in the message field, and the Horde_Auth::REASON_* constant in the code field (defaults to Horde_Auth::REASON_MESSAGE).
abstract protected _authenticate ( string $userId, array $credentials )
$userId string The userID to check.
$credentials array An array of login credentials.

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

Handles a bad login.
protected _badLogin ( string $userId )
$userId string The user with a bad login.

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

Resets the bad login counter.
protected _resetBadLogins ( string $userId )
$userId string The user to reset.

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

If the backend has listUsers and doesn't have a native sorting option, fall back to this method.
protected _sort ( array $users, boolean $sort ) : array
$users array An array of usernames.
$sort boolean Whether to sort or not.
Результат array the users, sorted or not

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

Adds a set of authentication credentials.
public addUser ( string $userId, array $credentials )
$userId string The userId to add.
$credentials array The credentials to use.

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

Finds out if a set of login credentials are valid, and if requested, mark the user as logged in in the current session.
public authenticate ( string $userId, array $credentials, boolean $login = true ) : boolean
$userId string The userId to check.
$credentials array The credentials to check.
$login boolean Whether to log the user in. If false, we'll only test the credentials and won't modify the current session. Defaults to true.
Результат boolean Whether or not the credentials are valid.

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

Checks if $userId exists in the system.
public exists ( string $userId ) : boolean
$userId string User ID for which to check
Результат boolean Whether or not $userId already exists.

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

Returns internal credential value(s).
public getCredential ( mixed $name = null ) : mixed
$name mixed The credential value to get. If null, will return the entire credential list. Valid names: - 'change': (boolean) Do credentials need to be changed? - 'credentials': (array) The credentials needed to authenticate. - 'expire': (integer) UNIX timestamp of the credential expiration date. - 'userId': (string) The user ID.
Результат mixed The credential information, or null if the credential doesn't exist.

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

Returns the error type or message for an invalid authentication.
public getError ( boolean $msg = false ) : mixed
$msg boolean If true, returns the message string (if set).
Результат mixed Error type, error message (if $msg is true) or false if entry doesn't exist.

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

Returns the named parameter for the current auth driver.
public getParam ( string $param ) : string
$param string The parameter to fetch.
Результат string The parameter's value, or null if it doesn't exist.

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

Queries the current driver to find out if it supports the given capability.
public hasCapability ( string $capability ) : boolean
$capability string The capability to test for.
Результат boolean Whether or not the capability is supported.

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

Returns whether a user is currently locked.
public isLocked ( string $userId, boolean $show_details = false ) : boolean | array
$userId string The user to check.
$show_details boolean Return timeout too?
Результат boolean | array If $show_details is a true, an array with 'locked' and 'lock_timeout' values. Whether the user is locked, otherwise.

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

Lists all users in the system.
public listUsers ( boolean $sort = false ) : mixed
$sort boolean Sort the users?
Результат mixed The array of userIds.

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

Locks a user indefinitely or for a specified time.
public lockUser ( string $userId, integer $time )
$userId string The user to lock.
$time integer The duration in minutes, 0 = permanent.

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

Deletes a set of authentication credentials.
public removeUser ( string $userId )
$userId string The userId to delete.

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

Reset a user's password. Used for example when the user does not remember the existing password.
public resetPassword ( string $userId ) : string
$userId string The user id for which to reset the password.
Результат string The new password on success.

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

Searches the users for a substring.
public searchUsers ( string $search ) : array
$search string The search term.
Результат array A list of all matching users.

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

Sets an internal credential value.
public setCredential ( string $type, mixed $value )
$type string The credential name to set. See getCredential() for the list of valid credentials/types.
$value mixed The credential value to set.

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

Sets the error message for an invalid authentication.
public setError ( string $type, string $msg = null )
$type string The type of error (Horde_Auth::REASON_* constant).
$msg string The error message/reason for invalid authentication.

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

Transparent authentication should set 'userId', 'credentials', or 'params' in $this->_credentials as needed - these values will be used to set the credentials in the session. Transparent authentication should normally never throw an error - false should be returned.
public transparent ( ) : boolean
Результат boolean Whether transparent login is supported.

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

Unlocks a user and optionally resets the bad login count.
public unlockUser ( string $userId, boolean $resetBadLogins = false )
$userId string The user to unlock.
$resetBadLogins boolean Reset bad login counter?

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

Updates a set of authentication credentials.
public updateUser ( string $oldID, string $newID, array $credentials )
$oldID string The old userId.
$newID string The new userId.
$credentials array The new credentials

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

These triggers are independent of the credentials.
public validateAuth ( ) : boolean
Результат boolean True if the results of authenticate() are still valid.

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

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

An array of capabilities, so that the driver can report which operations it supports and which it doesn't.
protected array $_capabilities
Результат array

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

The credentials currently being authenticated.
protected array $_credentials
Результат array

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

Authentication error information.
protected array $_error
Результат array

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

History object.
protected Horde_History $_history_api
Результат Horde_History

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

Lock object.
protected Horde_Lock $_lock_api
Результат Horde_Lock

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

Logger object.
protected Horde_Log_Logger $_logger
Результат Horde_Log_Logger

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

Hash containing parameters needed for the drivers.
protected array $_params
Результат array