english/libraries/joomla/user/authentication.php
/**
	 * Finds out if a set of login credentials are valid by asking all obvserving
	 * objects to run their respective authentication routines.
	 *
	 * @param   array  $credentials  Array holding the user credentials
	 * @param   array  $options      Array of options
	 *
	 * @return  mixed  Integer userid for valid user if credentials are valid or
	 *                 boolean false if they are not
	 *
	 * @see     JAuthenticationResponse
	 * @since   11.1
	 */
Finds out if a set of login credentials are valid by asking all obvserving
objects to run their respective authentication routines.

@param   array  $credentials  Array holding the user credentials
@param   array  $options      Array of options

@return  mixed  Integer userid for valid user if credentials are valid or
boolean false if they are not


Finds out if a set of login credentials are valid by asking all obvserving objects to run their respective authentication routines . @param array $credentials Array holding the user credentials @param array $options Array of options @return mixed Integer userid for valid user if credentials are valid or boolean false if they are not
public function authenticate($credentials, $options)
	{
		$auth = false;
		$plugins = JPluginHelper::getPlugin('authentication');
		$response = new JAuthenticationResponse;
		foreach ($plugins as $plugin)
		{
			$className = 'plg'.$plugin->type.$plugin->name;
			if (class_exists($className)) {
				$plugin = new $className($this, (array)$plugin);
			}
			else {
				JError::raiseWarning(50, JText::sprintf('JLIB_USER_ERROR_AUTHENTICATION_FAILED_LOAD_PLUGIN', $className));
				continue;
			}
			$plugin->onUserAuthenticate($credentials, $options, $response);
			if ($response->status === JAUTHENTICATE_STATUS_SUCCESS)
			{
				if (empty($response->type)) {
					$response->type = isset($plugin->_name) ? $plugin->_name : $plugin->name;
				}
				break;
			}
		}
		if (empty($response->username)) {
			$response->username = $credentials['username'];
		}
		if (empty($response->fullname)) {
			$response->fullname = $credentials['username'];
		}
		if (empty($response->password)) {
			$response->password = $credentials['password'];
		}
		return $response;
	}
public function authenticate ( $ credentials , $ options ) { $ auth = false ; $ plugins = JPluginHelper :: getPlugin ( 'authentication' ) ; $ response = new JAuthenticationResponse ; foreach ( $ plugins as $ plugin ) { $ className = 'plg' . $ plugin -> type . $ plugin -> name ; if ( class_exists ( $ className ) ) { $ plugin = new $ className ( $ this , ( array ) $ plugin ) ; } else { JError :: raiseWarning ( 50 , JText :: sprintf ( 'JLIB_USER_ERROR_AUTHENTICATION_FAILED_LOAD_PLUGIN' , $ className ) ) ; continue ; } $ plugin -> onUserAuthenticate ( $ credentials , $ options , $ response ) ; if ( $ response -> status === JAUTHENTICATE_STATUS_SUCCESS ) { if ( empty ( $ response -> type ) ) { $ response -> type = isset ( $ plugin -> _name ) ? $ plugin -> _name : $ plugin -> name ; } break ; } } if ( empty ( $ response -> username ) ) { $ response -> username = $ credentials [ 'username' ] ; } if ( empty ( $ response -> fullname ) ) { $ response -> fullname = $ credentials [ 'username' ] ; } if ( empty ( $ response -> password ) ) { $ response -> password = $ credentials [ 'password' ] ; } return $ response ; }
Finds out if a set of login credentials are valid by asking all obvserving
 objects to run their respective authentication routines.
Finds out if a set of login credentials are valid by asking all obvserving objects to run their respective authentication routines .
// Initialise variables. // Get plugins // Create authencication response /*
		 * Loop through the plugins and check of the creditials can be used to authenticate
		 * the user
		 *
		 * Any errors raised in the plugin should be returned via the JAuthenticationResponse
		 * and handled appropriately.
		 */ // Bail here if the plugin can't be created // Try to authenticate // If authentication is successful break out of the loop