The Horde_Core_Auth_Application class provides application-specific
authentication built on top of the horde/Auth API.
Copyright 2002-2012 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you did
not receive this file, see http://opensource.org/licenses/lgpl-2.1.php
Methods summary
public
|
#
__construct( array $params = array() )
Constructor.
Parameters
- $params
- Required parameters:
<pre><span class="php-quote">'app'</span> - (string) The application which is providing authentication.
<span class="php-quote">'base'</span> - (Horde_Auth_Base) The base Horde_Auth driver. Only needed <span class="php-keyword1">if</span>
<span class="php-quote">'app'</span> is <span class="php-quote">'horde'</span>.</pre>
Throws
InvalidArgumentException
|
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 user ID 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 )
Add a set of authentication credentials.
Add a set of authentication credentials.
Parameters
- $userId
- The user ID to add.
- $credentials
- The credentials to use.
Throws
Horde_Auth_Exception
|
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 userId to lock.
- $time
- The duration in seconds, 0 = permanent
Throws
Horde_Auth_Exception
|
public
|
#
unlockUser( string $userId, boolean $resetBadLogins = false )
Unlocks a user and optionally resets bad login count
Unlocks a user and optionally resets bad login count
Parameters
- $userId
- The userId to unlock.
- $resetBadLogins
- Reset bad login counter, default no.
Throws
Horde_Auth_Exception
|
public
|
#
isLocked( string $userId, boolean $show_details = false )
Checks if $userId is currently locked.
Checks if $userId is currently locked.
Parameters
- $userId
- The userId to check.
- $show_details
- Toggle array format with timeout.
Throws
Horde_Auth_Exception
|
public
|
#
updateUser( string $oldID, string $newID, array $credentials )
Update a set of authentication credentials.
Update a set of authentication credentials.
Parameters
- $oldID
- The old user ID.
- $newID
- The new user ID.
- $credentials
- The new credentials
Throws
Horde_Auth_Exception
|
public
|
#
removeUser( string $userId )
Delete a set of authentication credentials.
Delete a set of authentication credentials.
Parameters
- $userId
- The user ID to delete.
Throws
Horde_Auth_Exception
|
public
array
|
#
listUsers( )
List all users in the system.
List all users in the system.
Returns
array The array of user IDs.
Throws
Horde_Auth_Exception
|
public
boolean
|
#
exists( string $userId )
Checks if a user ID exists in the system.
Checks if a user ID exists in the system.
Parameters
- $userId
- User ID to check.
Returns
boolean Whether or not the user ID already exists.
|
public
boolean
|
#
transparent( )
Automatic authentication.
Automatic authentication.
Returns
boolean Whether or not the client is allowed.
Throws
Horde_Auth_Exception
|
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
Horde_Auth_Exception
|
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.
|
public
array
|
#
getLoginParams( )
Returns information on what login parameters to display on the login
screen.
Returns information on what login parameters to display on the login
screen.
Returns
array An array with the following keys:
'js_code' - (array) A list of javascript statements to be included via
Horde::addInlineScript().
'js_files' - (array) A list of javascript files to be included via
Horde::addScriptFile().
'params' - (array) A list of parameters to display on the login screen.
Each entry is an array with the following entries:
'label' - (string) The label of the entry.
'type' - (string) 'select', 'text', or 'password'.
'value' - (mixed) If type is 'text' or 'password', the
text to insert into the field by default. If type
is 'select', an array with they keys as the
option values and an array with the following keys:
'hidden' - (boolean) If true, the option will be
hidden.
'name' - (string) The option label.
'selected' - (boolean) If true, will be selected
by default.
Throws
Horde_Exception
|
public
boolean
|
#
requireAuth( )
Indicate whether the application requires authentication.
Indicate whether the application requires authentication.
Returns
boolean True if application requires authentication.
|
public
array
|
#
runHook( string $userId, array $credentials, string $type, string $method = null )
Runs the pre/post-authenticate hook and parses the result.
Runs the pre/post-authenticate hook and parses the result.
Parameters
- $userId
- The userId who has been authorized.
- $credentials
- The credentials of the user.
- $type
- <p>Either 'preauthenticate' or
'postauthenticate'.</p>
- $method
- <p>The triggering method (preauthenticate only).
Either 'authenticate' or 'transparent'.</p>
Returns
array Two element array, $userId and $credentials.
Throws
Horde_Auth_Exception
|