The Horde_Auth_Base:: class provides a common abstracted interface to
creating various authentication backends.
Copyright 1999-2012 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you did
not receive this file, http://www.horde.org/licenses/lgpl21
Methods summary
public
|
#
__construct( array $params = array() )
Constructor.
Parameters
- $params
- <p>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.</p>
|
public
boolean
|
#
authenticate( string $userId, array $credentials, boolean $login = true )
Finds out if a set of login credentials are valid, and if requested,
mark the user as logged in in the current session.
Finds out if a set of login credentials are valid, and if requested,
mark the user as logged in in the current session.
Parameters
- $userId
- The userId to check.
- $credentials
- The credentials to check.
- $login
- <p>Whether to log the user in. If false, we'll
only test the credentials and won't modify
the current session. Defaults to true.</p>
Returns
boolean Whether or not the credentials are valid.
|
public
boolean
|
#
validateAuth( )
Checks for triggers that may invalidate the current auth.
These triggers are independent of the credentials.
Checks for triggers that may invalidate the current auth.
These triggers are independent of the credentials.
Returns
boolean True if the results of authenticate() are still valid.
|
public
|
#
addUser( string $userId, array $credentials )
Adds a set of authentication credentials.
Adds a set of authentication credentials.
Parameters
- $userId
- The userId to add.
- $credentials
- The credentials to use.
Throws
|
public
|
#
lockUser( string $userId, integer $time = 0 )
Locks a user indefinitely or for a specified time.
Locks a user indefinitely or for a specified time.
Parameters
- $userId
- The user to lock.
- $time
- The duration in minutes, 0 = permanent.
Throws
Since
Horde_Auth 1.2.0
|
public
|
#
unlockUser( string $userId, boolean $resetBadLogins = false )
Unlocks a user and optionally resets the bad login count.
Unlocks a user and optionally resets the bad login count.
Parameters
- $userId
- The user to unlock.
- $resetBadLogins
- Reset bad login counter?
Throws
Since
Horde_Auth 1.2.0
|
public
boolean|array
|
#
isLocked( string $userId, boolean $show_details = false )
Returns whether a user is currently locked.
Returns whether a user is currently locked.
Parameters
- $userId
- The user to check.
- $show_details
- Return timeout too?
Returns
boolean|array If $show_details is a true, an array with
'locked' and 'lock_timeout' values. Whether the
user is locked, otherwise.
Throws
Since
Horde_Auth 1.2.0
|
public
|
#
updateUser( string $oldID, string $newID, array $credentials )
Updates a set of authentication credentials.
Updates a set of authentication credentials.
Parameters
- $oldID
- The old userId.
- $newID
- The new userId.
- $credentials
- The new credentials
Throws
|
public
|
#
removeUser( string $userId )
Deletes a set of authentication credentials.
Deletes a set of authentication credentials.
Parameters
- $userId
- The userId to delete.
Throws
|
public
mixed
|
#
listUsers( mixed $sort = false )
Lists all users in the system.
Lists all users in the system.
Returns
mixed The array of userIds.
Throws
|
public
boolean
|
#
exists( string $userId )
Checks if $userId exists in the system.
Checks if $userId exists in the system.
Parameters
- $userId
- User ID for which to check
Returns
boolean Whether or not $userId already exists.
|
public
boolean
|
#
transparent( )
Automatic authentication.
Automatic authentication.
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.
Returns
boolean Whether transparent login is supported.
Throws
|
public
string
|
#
resetPassword( string $userId )
Reset a user's password. Used for example when the user does not
remember the existing password.
Reset a user's password. Used for example when the user does not
remember the existing password.
Parameters
- $userId
- The user id for which to reset the password.
Returns
string The new password on success.
Throws
|
public
boolean
|
#
hasCapability( string $capability )
Queries the current driver to find out if it supports the given
capability.
Queries the current driver to find out if it supports the given
capability.
Parameters
- $capability
- The capability to test for.
Returns
boolean Whether or not the capability is supported.
|
public
string
|
#
getParam( string $param )
Returns the named parameter for the current auth driver.
Returns the named parameter for the current auth driver.
Parameters
- $param
- The parameter to fetch.
Returns
string The parameter's value, or null if it doesn't exist.
|
public
mixed
|
#
getCredential( mixed $name = null )
Retrieve internal credential value(s).
Retrieve internal credential value(s).
Parameters
- $name
- <p>The credential value to get. If null, will return
the entire credential list. Valid names:</p>
<pre><span class="php-quote">'change'</span> - (boolean) <span class="php-keyword1">Do</span> credentials need to be changed?
<span class="php-quote">'credentials'</span> - (<span class="php-keyword1">array</span>) The credentials needed to authenticate.
<span class="php-quote">'expire'</span> - (integer) UNIX timestamp of the credential expiration <span class="php-keyword2">date</span>.
<span class="php-quote">'userId'</span> - (string) The user ID.</pre>
Returns
mixed Return the credential information, or null if the
credential doesn't exist.
|
public
|
#
setCredential( string $type, mixed $value )
Set internal credential value.
Set internal credential value.
Parameters
- $type
- $name The credential name to set.
- $value
- <p>The credential value to set. See getCredential()
for the list of valid credentials/types.</p>
|
public
|
#
setError( string $type, string $msg = null )
Sets the error message for an invalid authentication.
Sets the error message for an invalid authentication.
Parameters
- $type
- The type of error (Horde_Auth::REASON_* constant).
- $msg
- <p>The error message/reason for invalid
authentication.</p>
|
public
mixed
|
#
getError( boolean $msg = false )
Returns the error type or message for an invalid authentication.
Returns the error type or message for an invalid authentication.
Parameters
- $msg
- If true, returns the message string (if set).
Returns
mixed Error type, error message (if $msg is true) or false
if entry doesn't exist.
|