CoreFiles by mySites.guru
example.php64 lines, 1,726 bytes, from Joomla_1.6.1-Stable-Full_Package.zip
Raw History Compare with 1.6.0
md5
b8518d4a192bed3d1d148b51f7dcde1d
sha1
deff9c3214798cfc9c8baae052fc3ca3f3294238
sha256
9ebde5a1af207cbb5d519740d43dc000fac18eef9e09d78c99e8d180c2da80e8
<?php
/**
 * @version		$Id: example.php 20196 2011-01-09 02:40:25Z ian $
 * @package		Joomla
 * @subpackage	JFramework
 * @copyright	Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// No direct access
defined('_JEXEC') or die;

jimport('joomla.plugin.plugin');

/**
 * Example Authentication Plugin
 *
 * @package		Joomla
 * @subpackage	JFramework
 * @since 1.5
 */
class plgAuthenticationExample extends JPlugin
{
	/**
	 * This method should handle any authentication and report back to the subject
	 *
	 * @access	public
	 * @param	array	$credentials	Array holding the user credentials
	 * @param	array	$options		Array of extra options
	 * @param	object	$response		Authentication response object
	 * @return	boolean
	 * @since	1.5
	 */
	function onUserAuthenticate($credentials, $options, &$response)
	{
		/*
		 * Here you would do whatever you need for an authentication routine with the credentials
		 *
		 * In this example the mixed variable $return would be set to false
		 * if the authentication routine fails or an integer userid of the authenticated
		 * user if the routine passes
		 */
		$success = true;
		$response->type = 'Example';
		if ($success)
		{
			$response->status			= JAUTHENTICATE_STATUS_SUCCESS;
			$response->error_message	= '';
			// You may also define other variables:
			/*
			$yourUser					= YourClass::getUser($credentials);
			$response->email			= $yourUser->email;
			$response->fullname			= $yourUser->name;
			*/
			return true;
		}
		else
		{
			$response->status			= JAUTHENTICATE_STATUS_FAILURE;
			$response->error_message	= 'Could not authenticate';
			return false;
		}
	}
}

The same content is in 2 releases, Joomla 1.6.0 to 1.6.1. See them all, or every version of this file.